Main Classes

Xafari.ModelDifferenceStoreManager

Xafari.ModelDifferenceStoreManager controls the creation of the Model Differences store. ModelDifferenceStoreManager is implemented as a singleton. To access manager instance use static Instance property.

ModelDifferenceStoreFactory property gets or sets current Model Differences store factory.

When set a new instance of the store factory, two events occures: BeforeChangeModelDifferenceStoreFactory and AfterChangeModelDifferenceStoreFactory. This events allows to monitor in code when changing the store factory. In apropriate event handlers you can subscribe/unsubscribe to events, that are generated by the factory.

Xafari.ModelDifferenceStoreFactory

Xafari.ModelDifferenceStoreFactory abstract class is the base class for any custom factory. CreateModelDifferenceStore() and CreateUserModelDifferenceStore() methods creates and returns an instances of the appropriate stores. When creating store the factory generate CustomizeModelDifferenceSoreParams или CustomizeUserModelDifferenceSoreParams events. Implement event handlers to manage the parameters of the created store instance. When implementing your own factory by deriving from the ModelDifferenceStoreFactory, it is necessary to override one or two protected override methods: CreateModelDifferenceStoreCore(ModelDifferenceStoreParamsEventArgs), CreateUserModelDifferenceStoreCore(ModelDifferenceStoreParamsEventArgs). This methods receives an instance of the ModelDifferenceStoreParamsEventArgs class which contains the parameters to initialise the created store instance.

Overriden method must creates and returns Model Differences store instance, i.e. it is DevExpress.ExpressApp.ModelDifferenceStore descendant. If the overridden method returns null, then the default store will be created, i.e. implemented by the WebApplication or WinApplication classes.

Xafari.ModelDifferenceStoreParamsEventArgs

Xafari.ModelDifferenceStoreFactory class generates CustomizeModelDifferenceStoreParams и CustomizeUserModelDifferenceStoreParams events. ModelDifferenceStoreParamsEventArgs class is a parameter of this events. It exposes ExtendCode(string) method and Code property.

Application code reads (writes) Model Differences aspects using search key. ExtendCode method extends the search key by adding new segments. When searching, framework sorts segments in ascending order. Then segments are concatenated into a single string. The resulting string is the search key. Code property provides the key to search the aspect.

That is, for example, one user may have multiple different independent User Model Differences, if necessary.

Xafari.FileUserModelDifferenceStoreFactory, Xafari.FileUserModelDifferenceStore

These classes provides User Model Differences store. It uses by default in Xafari Win. Xafari.Win module creates an instance of the FileUserModelDifferenceStoreFactory and assign it to the ModelDifferenceStoreManager. The distinction from the default XAF FileModelStore is that the FileUserModelDifferenceStore class separates Diferences for each user. User Model Differences is stored in the Model.User.<USER_NAME>[.<CONTEXT_ID>][_aspect].xafml files, file name has additional sections:

  • <USER_NAME> specifies the name of current user
  • <CONTEXT_ID> specifies the value of the ModelDifferenceStoreParamsEventArgs.ContextId property. If this value was not set in code, <CONTEXT_ID> section is not presented in the file name.

Xafari.Web.SessionUserModelDifferenceStoreFactory, Xafari.Web.SessionUserModelDifferenceStore

These classes provides User Model Differences store. It uses by default in Xafari ASP.NET. Xafari.Web module creates an instance of the FileUserModelDifferenceStoreFactory and assign it to the ModelDifferenceStoreManager. SessionUserModelDifferenceStore class stores the User Model Differences in cookie separately for each user and for each ModelDifferenceStoreParamsEventArgs.ContextId value (naturally, if this value was set in the code).