Skip to main content
.NET 6.0+

XafApplication.CustomCheckCompatibility Event

Occurs when trying to access the application’s database (when logging on or creating an Object Space).

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v24.1.dll

NuGet Package: DevExpress.ExpressApp

Declaration

public event EventHandler<CustomCheckCompatibilityEventArgs> CustomCheckCompatibility

Event Data

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

Property Description
ApplicationName Specifies the application’s name.
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.
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.

Remarks

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.

Note

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.

Note that in applications with the Application Builder, you need to use the Application Builder’s ObjectSpaceProviders property to register Object Space Providers instead of the XafApplication.CreateDefaultObjectSpaceProvider method or XafApplication.CreateCustomObjectSpaceProvider event to register Object Space Providers. Refer to the following help topic for more information on how to do this: Integrate Application Builders into Existing Applications.

We strongly recommend this because the use of the XafApplication.CreateDefaultObjectSpaceProvider method and XafApplication.CreateCustomObjectSpaceProvider event conflicts with IObjectSpaceFactory and IObjectSpaceProviderFactory service usage.

This technique also improves performance of your application because the application instance is not created in this case.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CustomCheckCompatibility 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.

See Also