LinqConnect supports external (XML) mapping. You can split your entities and mapping rules with the help of this technology. A separate XML file is used to specify mapping between database and your object model. You can treat this file like a configuration file for your application.
Note: |
---|
External mapping overrides attribute-based mapping. In other words, when you use an external mapping source to create a DataContext, it ignores all mapping attributes you have created on classes. |
To use external mapping, one needs to create the XML mapping file. The main model file (e.g., CrmDemoContext.lqml) should not be used for this purpose, as it stores extended information about entity fields and database columns. Thus, .lqml files include properties not declared in the mapping files schema.
To create the proper file, set the 'Mapping Mode' model property to 'File'. In this case, Entity Developer will generate a mapping file (for example, CrmDemoContext.xml) that satisfies the standard schema. You can use it in the following way:
If this file is saved as an embedded resource of the compiled assembly, it should be used as: