Search This Blog

Friday, December 29, 2017

SQL Server-related methods of ModuleUpdater and pooled database connections

Before the end of this year, I wanted to inform you of some "home work" done by us to improve your XAF development experience with the ModuleUpdater API:

By default, ConnectionStringDataStoreProvider creates an updating data store with pooling (DataStorePool), which may cause NullReferenceException on calling the DropTable, DropColumn, DropIndex, DropConstraint, RenameTable, RenameColumn, UpdateXPObjectType, DeleteObjectType and other SQL Server-related methods of ModuleUpdater.

The reason is that during the CreateCommand call, the (((BaseObjectSpace)objectSpace).Connection or Session.Connection objects may be null in this particular configuration, as expected.

Starting with v17.2.5, we have corrected this behavior that led to the aforementioned error, and now we create a regular or not-pooled updating data store. It allows the usage of ModuleUpdater SQL Server-related methods without problems during the database update (a working data store is still created with pooling, as before). Take special note that these ModuleUpdater methods are legacy and specific to SQL Server only (they do not work for other database engines). A better approach can be used: cast an object space to XPObjectSpace, access its XPObjectSpace.Session member, and use corresponding methods of the DevExpress.Xpo.Session class. Refer to the Direct SQL Queries help topic.

Try this hot fix build, if you cannot wait for the next maintenance build. My team and I look forward to hearing from you on this.

No comments:

Post a Comment