With Telerik Data Access
you can map one or more tables to one class, but you cannot map one table to more than one class. So to achieve this behavior, you should have a transient internal property in the Person
class which will be mapped to the column in the table. Then the object from the second class - Document
must be created when the Person
object is created and then set the Document.Document
property to be linked with the transient property.
For your convenience I have prepared and attached a sample application to demonstrate this mapping.
In the sample application, to set the transient property accessibility level to internal, I am creatin a static mapping located in the class file, not in the FluentModelMetadataSource
uses DataAccess Enhancer
to read and process compiled .NET assemblies for adding persistent capability. When the Enhancer processes the compiled assemblies, it searches in the code for methods of type public static MappingConfiguration<> and enhances the classes which are mapped in these methods. This is an alternative version how you can create the mapping for every class in the class itself. You should have in mind that you can have only one mapping for a class, you cannot have a static mapping in the class and another mapping in the FluentModelMetadataSource.
I hope that helps.
OpenAccess ORM is now Telerik Data Access
. For more information on the new names, please, check out the Telerik Product Map