Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to customize an XPO business model at runtime (Example)

$
0
0

Sometimes there is a requirement to extend existing business classes from other libraries, add new members, etc.

For instance, you have an assembly where you have declared your persistent classes. Now, you want to use these classes in your XAF application.

Note that to use the types from external assemblies, you should add them to your business model. To do that, you should use the Business Classes section of the Module Designer.


For instance, to force XAF to create navigation items for business classes, usually you can mark them with the DevExpress.Persistent.Base.DefaultClassOptionsAttribute, but what to do if your classes "live" in a separate assembly, which has no references to DevExpress.ExpressApp assemblies.

What to do? In this instance, the XafTypesInfo / XPDictionary customization may be helpful. Currently in XAF using this approach, you can add new attributes to your classes and their members, declare new associations, etc. The only thing, which is not currently supported in XAF, by default, is the capability to declare new classes "on the fly" via customization of the XafTypesInfo / XPDictionary. 

IMPORTANT NOTES

1. By design you cannot dynamically add or remove the OptimisticLocking and DeferredDeletion attributes.
2. Adding custom members for Domain Components (DC) should be done on the XafApplication.SettingUp event as described at How do I define a custom member for a domain component (DC) at runtime?.
3. You cannot dynamically establish an association between two persistent classes via the XafTypesInfo API. Use the XPDictionary API instead.


See also:
How to: Access Business Class Metadata

Question Comments

Added By: Denis S at: 11/15/2013 5:58:17 AM    

Update the MyXPOClassLibrary project from Framework 3.0 to 4.0, in order to compile.


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>