Occurs when a storage for model differences is being created.
The CreateCustomModelDifferenceStore event's data class is CreateCustomModelDifferenceStoreEventArgs. The following properties provide information specific to this event:
|Handled||Gets 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.|
|Store||Specifies a custom Application Model differences storage to be used by the application.|
The event data class exposes the following methods:
|AddExtraDiffStore(String, ModelStoreBase)||Adds extra model differences storage.|
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.
If you need to modify the mechanism of Application Model differences store in both an ASP.NET and Windows Forms application, you need to use an individual handler in the ASP.NET 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.