Search This Blog

Monday, May 6, 2013

XAF and several business classes with the same name, but declared within different assemblies

We have implemented a highly requested feature in the next major version and you probably already know what I am talking about by the subject. If not, try to remember if you have implemented classes with common names like Party, Address, Person, Country in your application and then realized that there are already such entities in the default DevExpress.Persistent.BaseImpl library, which conflicted with your own stuff. It was certainly possible to solve these conflicts by either excluding the BaseImpl library from your project or recompiling it, or by renaming your own classes. Now, there should not be such inconveniences at all!

Starting with version 13.1, you can use classes with the same name but different full names.
To implement this functionality, the identifier generation algorithm for several model nodes has been changed: IModelClass, IModelView, MethodSimpleAction, MethodParameterObjectAction.
Use the DevExpress.ExpressApp.Model.NodeGenerators.ModelNodeIdHelper class to get the necessary ID by a type.
For example, to get a LookupListView's model for the DomainObject type, you can execute the following code:
Type targetType = typeof(DomainObject); string viewId = ModelNodeIdHelper.GetLookupListViewId(targetType); IModelView modelView = Application.Model.Views[viewId];


  1. How about two classes with the same, different namespaces in xxx.Model project? I think XAF will generate both classes with the same View name, hence there would be a conflict.

  2. XAF has a solution for this. Check out the thread for more details.