Occurs when trying to access the application's database (when logging on or creating an Object Space).
public event EventHandler<CustomCheckCompatibilityEventArgs> CustomCheckCompatibility
Public Event CustomCheckCompatibility As EventHandler(Of CustomCheckCompatibilityEventArgs)
The CustomCheckCompatibility event handler receives an argument of the CustomCheckCompatibilityEventArgs type. The following properties provide information specific to this event.
|ApplicationName||Specifies the application's name.|
|IsCompatibilityChecked||Indicates whether a compatibility check has already been performed.|
|Modules||Lists all Modules used by the application.|
|ObjectSpaceProvider||Specifies the Object Space Provider to be used for compatibility checking purposes.|
The CustomCheckCompatibility event is raised as a result of the XafApplication.CheckCompatibility method call. Handle this event to perform a custom check of the application and database compatibility, update the database, or any other action. Use the handler's CustomCheckCompatibilityEventArgs.ApplicationName parameter, to compare the actual application name and the application name written in the database. To compare the actual versions of the application's modules and the ones written in the database, use the handler's CustomCheckCompatibilityEventArgs.Modules parameter. Use the CustomCheckCompatibilityEventArgs.ObjectSpaceProvider's methods to create a Session or an Object Space, to work with the database. Set the handler's Handled parameter to true, to cancel executing default actions. By default, if the application is being run in the debugging mode, the XafApplication.DatabaseVersionMismatch event is raised. Otherwise, the database and application compatibility is checked. If the database cannot be opened or its version is older than the actual application version, the XafApplication.DatabaseVersionMismatch event is raised.
The CustomCheckCompatibility event is raised many times. So, database-intensive checking should only be performed on the first compatibility check, when the CustomCheckCompatibilityEventArgs.IsCompatibilityChecked property returns false.
XAF uses the first registered Object Space Provider for the following purposes:
Ensure that NonPersistentObjectSpaceProvider is not the first registered Provider in your application.