XAF – A Simpler Way to Check Database Compatibility (Coming soon in v15.2)

XAF Team Blog
27 November 2015


In earlier versions, to check the compatibility of an application and its database, a ModuleInfo table was created in the database. This table stores information on the module versions used in an application. When checking the compatibility of the database and the application, the versions stored in the ModuleInfo table are compared with actual module versions. A DatabaseVersionMismatch event occurs when there's a mismatch. By default, each module's version is set to "1.0.*" using the AssemblyVersion Attribute in the Properties\AssemblyInfo.cs file. The asterisk sign in the version indicates that the build and revision numbers in the version are autoincremented, and so version value is updated with each new build. As a result, WinForms and ASP.NET module versions may not be synced if you build WinForms and ASP.NET applications separately (e.g, when creating a ClickOnce installation or deploying to IIS).

With v15.2, we've introduced a new application and database compatibility check mode; one that utilizes native XPO methodologies. In this mode, the following checks are performed:

  1. The database exists.

  2. All required tables exist.

  3. All required columns exist.


The DatabaseVersionMismatch event occurs if any of these checks fails.

The new XafApplication.CheckCompatibilityType property specifies which mode to use. The CheckCompatibilityType.ModuleInfo value indicates that the old mode that relies on the ModuleInfo table is used. This mode is still used by default for applications created with earlier versions of XAF. In applications created with the Solution Wizard in version v15.2, the XafApplication.CheckCompatibilityType value is CheckCompatibilityType.DatabaseSchema, which corresponds to the new mode detailed above. This property value can be changed in the Application Designer:

Untitled (1)


Note that the use of ModuleInfo is more complicated, but it ensures business logic compatibility in addition to data model compatibility. The new DatabaseSchema mode relies on the database schema only.

A CheckCompatibilityType property has also been added to the IObjectSpaceProvider interface, allowing you to specify the mode individually for each Object Space Provider (when you use multiple databases). By default, it is set to null and the XafApplication.CheckCompatibilityType value is actually used. Another useful change with this interface is the new  IObjectSpaceProvider.SchemaUpdateMode property. You can now use it to specify handle compatibility checking for the database associated with the current Object Space Provider. The following values are available:

  • DatabaseAndSchema - Missing database is autocreated. The database schema is updated when the compatibility check fails.

  • None - Database compatibility issues are ignored.


That's my  last post prior to launch and hopefully you've liked what we've done with XAF. As always, we want to hear your thoughts. Please tell us what you think of XAF v15.2.

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.