Back to Devexpress

XafApplication.CreateCustomModelDifferenceStore Event

expressappframework-devexpress-dot-expressapp-dot-xafapplication-5d9b55e5.md

latest6.7 KB
Original Source

XafApplication.CreateCustomModelDifferenceStore Event

Occurs when a storage for model differences is being created.

Namespace : DevExpress.ExpressApp

Assembly : DevExpress.ExpressApp.v25.2.dll

NuGet Package : DevExpress.ExpressApp

Declaration

csharp
public event EventHandler<CreateCustomModelDifferenceStoreEventArgs> CreateCustomModelDifferenceStore
vb
Public Event CreateCustomModelDifferenceStore As EventHandler(Of CreateCustomModelDifferenceStoreEventArgs)

Event Data

The CreateCustomModelDifferenceStore event's data class is CreateCustomModelDifferenceStoreEventArgs. The following properties provide information specific to this event:

PropertyDescription
HandledGets or sets a value that indicates whether the event handler has completely handled the event or whether the system should continue its own processing. Inherited from HandledEventArgs.
StoreSpecifies a custom Application Model differences storage to be used by the application.

The event data class exposes the following methods:

MethodDescription
AddExtraDiffStore(String, ModelStoreBase)Adds extra model differences storage.

Remarks

The Application Model‘s base content formed from the code can be changed via the Model Editor. When the Application Model is loaded, the changes from the Model.xafml file are superimposed on the content generated previously. To load the changes saved to the Model.xafml file, a special storage is used. It finds this file near the executable file in the application project and load changes to the Application Model. For details, refer to the Model Difference Storages article.

If you need to store the Model.xafml file in a custom resource (e.g., in a Web service or register), implement your own storage by inheriting from the ModelDifferenceStore abstract class. To make the system use your storage, handle the CreateCustomModelDifferenceStore event and set it for the handler’s Store parameter. To prohibit the creation of the default storage object, set the handler’s Handled parameter to true.

Note

If you need to modify the mechanism of Application Model differences store in both an ASP.NET Core Blazor and Windows Forms application, you need to use an individual handler in the ASP.NET Core Blazor and Windows Forms application.

To see an example of using the CreateCustomModelDifferenceStore event, refer to the How to: Store the Application Model Differences in the Database topic. To use a custom storage for saving and loading an end-user’s Application Model changes, handle the XafApplication.CreateCustomUserModelDifferenceStore event.

The following code snippets (auto-collected from DevExpress Examples) contain references to the CreateCustomModelDifferenceStore event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

XAF_how-to-show-filter-dialog-before-listview/CS/E1554.Module.Win/WinModule.cs#L25

csharp
application.ModelChanged += new EventHandler(application_ModelChanged);
application.CreateCustomModelDifferenceStore += Application_CreateCustomModelDifferenceStore;
application.CreateCustomUserModelDifferenceStore += Application_CreateCustomUserModelDifferenceStore;

xaf-how-to-save-the-currently-opened-view-as-a-new-view-variant-at-runtime/CS/XPO/ViewVariantSave/ViewVariantSave.Module/Module.cs#L40

csharp
base.Setup(application);
application.CreateCustomModelDifferenceStore += Application_CreateCustomModelDifferenceStore;
application.CreateCustomUserModelDifferenceStore += Application_CreateCustomUserModelDifferenceStore;

XAF_how-to-show-filter-dialog-before-listview/VB/E1554.Module.Win/WinModule.vb#L27

vb
AddHandler application.ModelChanged, AddressOf application_ModelChanged
AddHandler application.CreateCustomModelDifferenceStore, AddressOf Application_CreateCustomModelDifferenceStore
AddHandler application.CreateCustomUserModelDifferenceStore, AddressOf Application_CreateCustomUserModelDifferenceStore

See Also

XafApplication Class

XafApplication Members

DevExpress.ExpressApp Namespace