MainContext
Here is an example that demonstrates the use of a MainContext component.
A MainContext is used to encapsulate one or more RecordContexts or MainGrids and keeps track of any changes made to them. By including a SaveContextButton or RefreshContextButton you can persist the changes to Dataverse or discard and refresh the record/s from Dataverse.
One or more RecordContexts can be contained in a MainContext component.
If the SaveContextButton is used, all records will be saved at the same time in a DB transaction on the server.
If any of the records fail to save, the transaction will rollback safely and none of the records state will have been persisted to Dataverse.
MainContext Class
Parameters
Name | Type | Default | Description |
|---|---|---|---|
ChildContent | RenderFragment? | ||
ForceSuccessfulValidationBeforeSave | bool | True | Should a successful validation of the record be performed before allowing the record to be saved. |
IsDirty | bool | False | |
ParentContext | MainContext? |
Methods
Name | Parameters | Type | Description |
|---|---|---|---|
GetRequests | List<RequestBase> | ||
RefreshAsync | bool forceRefresh | Task | |
ResetState | void | ||
SaveAsync | bool? refresh | Task<bool> | Save the context and any child contexts (grid, record, etc). |
Validate | bool |