public abstract class MtBaseComponent : ComponentBase,
IHasLocalization, IHasNavigationManager, IDisposable| MtBaseComponent | Initializes a new instance of the MtBaseComponent class |
| CancellationToken | Cancellation token for the component; this can be used for asynchronous operations on the components, to shut them down if the component has ended its lifetime. |
| CompanyId | The CompanyDto the user is currently working with. |
| CosmosDb | Dependency injection for the Azure Cosmos Database ORMs |
| CurrentUser | Dependency injected user state service. |
| EnvironmentId | The EnvironmentDto the user is currently working with. |
| FailureHandler | Send emails to developers in case of technical failures (mostly due to bugs) in the component. |
| HideForbiddenElements | Whether to hide elements if the user is forbidden from accessing them. This is composed when we receive the permissions; by going through each role in the stack, if any of them allow hidden elements to be shown, we will show them. |
| HttpContextAccessor | HTTP Context Accessor |
| InPreview | All components start in preview while the data for said components are being load/generated. Once complete, InPreview flips to . |
| Loc |
Dependency injection for the localization tool. It derives texts established in CosmosDB's "LocalizedStrings" container.
It can be used by invoking it as an array, with the key of the text you want to get. Parameters for the string can be added in the array as well,
similar to Format(String, Object). If the text is not found, it will return the key itself as fallback. The language the key will be localized based on is based on the CurrentCulture and the CurrentUICulture. If you want to localize something in a different language, you will have to apply the culture on the CultureInfo properties, get the text, and revert back to the original culture. |
| ModalService | Dependency injected ModalService for showing dialogs. |
| NavigationManager |
Dependency injected NavigationManager for navigating to different pages. Note: in Blazor, navigation is done in a 'fake' manner so the entire page doesn't need to be reloaded. If you want to make sure the page is reloaded, or if we're going somewhere outside the Blazor context, ensure you set the parameter 'forceLoad' in method NavigateTo(String, Boolean, Boolean) to true. |
| Permissions | List of permissions that apply to the component. |
| ReplicationLayer |
Connection to the Replication Layer on the Azure Cache for Redis; within components, it is used for subscriptions in case of data changes. To retrieve/send data, use the CosmosDb instead. |
| RequiredPermissionsForManage | Lists the permissions the user needs to be able to manage the page/item |
| RequiredPermissionsForView | Lists the permissions the user needs to be able to view the page/item |
| Title | Human-readable title of the component. Note: will not be rendered/populated unless invoked! |
| ToastService | Toast messages service |
| Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. |
| IsAuthorizedToManage | Function where we are going to check whether the user is allowed to manage the items on this page. Normally, this method doesn't have to be overriden if the page is view-only, or if view authorization is the same as IsAuthorizedToView. |
| IsAuthorizedToView | Function that checks whether the user is allowed to view the page. The page using this method should override this method to check if the user's role assignments contains the correct PermissionValueMap through the HasPermission(RoleDto, PermissionValueMap) method. |
| LoadData | Loads the data that the component requires to get out of preview. It is invoked in the OnParametersSetAsync method of MtBaseComponent |
| NotHidden | If true, show the item. |
| OnAfterRender |
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.
(Overrides ComponentBaseOnAfterRender(Boolean)) |
| 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.
(Overrides ComponentBaseOnParametersSetAsync) |
| RetrievePermissions | Retrieves the permissions the user has for the scope of the current page/item |
| ShouldRender |
We only render the component if the user is allowed to view it.
(Overrides ComponentBaseShouldRender) |