Search This Blog

Thursday, October 25, 2012

Refactoring the XAF database updater functionality

These days we have been refactoring the DatabaseUpdater and ModuleUpdater classes (responsible for database schema creation, versioning and supplying initial data for your application). First, I would like to talk about the improvement described at

"Starting with 12.2, you can override (it is recommended for better performance) the GetModuleTypes method and create required ModuleUpdaters manually. If you do not override this method, XAF will look for ModuleUpdater descendants itself. This is required to avoid a breaking change in existing applications.
If your custom module is not supposed to provide any updates to the database, then override the method as follows:

[C#]public override IEnumerable<ModuleUpdater> GetModuleUpdaters(IObjectSpace objectSpace, Version versionFromDB) { return ModuleUpdater.EmptyModuleUpdaters; }

All standard XAF modules and templates will follow these best practices as well."


Second, we should also free the ORM-agnostic ModuleUpdater class from the remainder XPO stuff related to schema modifications (DeleteObjectType, DropColumn and the like). Probably, it is good to move all these methods into a helper class in DevExpress.ExpressApp.Xpo.

Yesterday, I have also fixed a small issue in the DBUpdater tool  prevented it from using a user-defined DatabaseUpdater class. I have also removed all XPO dependencies from it.

Probably, the last thing to work here is as it may come in handy for more user friendly splashes with progress, like the ones Adobe loves;-)

No comments:

Post a Comment