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.

Example
Save Refresh
Contact Record
Account Record

MainContext Class

Parameters

Name
Type
Default
Description
ChildContentRenderFragment?
ForceSuccessfulValidationBeforeSavebool
True
Should a successful validation of the record be performed before allowing the record to be saved.
IsDirtybool
False
ParentContextMainContext?
ValidationSummaryIsVisiblebool
False
Display the validation summary.

Methods

Name
Parameters
Type
Description
GetRequestsList<RequestBase>
RefreshAsyncbool forceRefresh
Task
ResetStatevoid
SaveAsyncbool? refresh
Task<bool>
Save the context and any child contexts (grid, record, etc).
Validatebool