EnvironmentBoundary Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
A component that renders its child content only when the current hosting environment matches one of the specified environment names.
public sealed class EnvironmentBoundary : Microsoft.AspNetCore.Components.ComponentBase
type EnvironmentBoundary = class
inherit ComponentBase
Public NotInheritable Class EnvironmentBoundary
Inherits ComponentBase
- Inheritance
Remarks
This component is similar to the environment tag helper in MVC and Razor Pages.
<EnvironmentBoundary Include="Development">
<div class="alert alert-warning">
You are running in Development mode. Debug features are enabled.
</div>
</EnvironmentBoundary>
<EnvironmentBoundary Include="Development, Staging">
<p>This is a pre-production environment.</p>
</EnvironmentBoundary>
<EnvironmentBoundary Exclude="Production">
<p>Debug information: @DateTime.Now</p>
</EnvironmentBoundary>
Constructors
| Name | Description |
|---|---|
| EnvironmentBoundary() | |
Properties
| Name | Description |
|---|---|
| Assets |
Gets the ResourceAssetCollection for the application. (Inherited from ComponentBase) |
| AssignedRenderMode |
Gets the IComponentRenderMode assigned to this component. (Inherited from ComponentBase) |
| ChildContent |
Gets or sets the content to be rendered when the environment matches. |
| Exclude |
Gets or sets a comma-separated list of environment names in which the content will not be rendered. |
| Include |
Gets or sets a comma-separated list of environment names in which the content should be rendered. If the current environment is also in the Exclude list, the content will not be rendered. |
| RendererInfo |
Gets the RendererInfo the component is running on. (Inherited from ComponentBase) |
Methods
| Name | Description |
|---|---|
| BuildRenderTree(RenderTreeBuilder) |
Renders the component to the supplied RenderTreeBuilder. (Inherited from ComponentBase) |
| DispatchExceptionAsync(Exception) |
Treats the supplied This is useful if an exception occurs outside the component lifecycle methods, but you wish to treat it the same as an exception from a component lifecycle method. (Inherited from ComponentBase) |
| InvokeAsync(Action) |
Executes the supplied work item on the associated renderer's synchronization context. (Inherited from ComponentBase) |
| InvokeAsync(Func<Task>) |
Executes the supplied work item on the associated renderer's synchronization context. (Inherited from ComponentBase) |
| OnAfterRender(Boolean) |
Method invoked after each time the component has rendered interactively and the UI has finished updating (for example, after elements have been added to the browser DOM). Any ElementReference fields will be populated by the time this runs. This method is not invoked during prerendering or server-side rendering, because those processes are not attached to any live browser DOM and are already complete before the DOM is updated. (Inherited from ComponentBase) |
| OnAfterRenderAsync(Boolean) |
Method invoked after each time the component has been rendered interactively and the UI has finished updating (for example, after elements have been added to the browser DOM). Any ElementReference fields will be populated by the time this runs. This method is not invoked during prerendering or server-side rendering, because those processes are not attached to any live browser DOM and are already complete before the DOM is updated. Note that the component does not automatically re-render after the completion of any returned Task, because that would cause an infinite render loop. (Inherited from ComponentBase) |
| OnInitialized() |
Method invoked when the component is ready to start, having received its initial parameters from its parent in the render tree. (Inherited from ComponentBase) |
| OnInitializedAsync() |
Method invoked when the component is ready to start, having received its initial parameters from its parent in the render tree. Override this method if you will perform an asynchronous operation and want the component to refresh when that operation is completed. (Inherited from ComponentBase) |
| OnParametersSet() |
Method invoked when the component has received parameters from its parent in the render tree, and the incoming values have been assigned to properties. (Inherited from ComponentBase) |
| OnParametersSetAsync() |
Method invoked when the component has received parameters from its parent in the render tree, and the incoming values have been assigned to properties. (Inherited from ComponentBase) |
| SetParametersAsync(ParameterView) |
Sets parameters supplied by the component's parent in the render tree. (Inherited from ComponentBase) |
| ShouldRender() |
Returns a flag to indicate whether the component should render. (Inherited from ComponentBase) |
| StateHasChanged() |
Notifies the component that its state has changed. When applicable, this will cause the component to be re-rendered. (Inherited from ComponentBase) |
Explicit Interface Implementations
| Name | Description |
|---|---|
| IComponent.Attach(RenderHandle) | (Inherited from ComponentBase) |
| IHandleAfterRender.OnAfterRenderAsync() | (Inherited from ComponentBase) |
| IHandleEvent.HandleEventAsync(EventCallbackWorkItem, Object) | (Inherited from ComponentBase) |