In order to overcome this issue, you have to create mapping for the base class expanding your Fluent Model
. For example let’s create a class named BaseEntity
which has a property named Id
that represents the primary key. Each entity derives from the BaseEntity
class. I have created the following mapping for this class:
MappingConfiguration<BaseEntity> baseEntityConfiguration =
baseEntityConfiguration.HasProperty(x => x.Id).HasFieldName(
Please note that there is mapping for the Id
property and that the inheritance
strategy is set to horizontal
allowing the Id
property to be part of the table that corresponds to each derived class.
In order to allow derived entities to use the Id
declared in the base class the correct field (the one that comes from the base class) has to be set. For this reason the following modification in each of the derived classes mapping has to be made:
configuration.HasProperty(x => x.Id).IsIdentity(KeyGenerator.Autoinc).HasFieldName(
While it is possible to distribute the model's entities in separate projects (Fluent Libraries
) using the AggregateMetadataSource
feature of Telerik Data Access
I would advice you not to in this case unless you have some consideration that would benefit from that feature. Could you please tell us more about your current implementation scenario that requires the BaseEntitiy
class to be distributed as part of another assembly so we could advice you better? Is it possible to use an interface (implemented by the BaseEntitiy
class) in order to achieve the same functionality?
Please do not hesitate to contact us again should you have any further questions.
OpenAccess ORM is now Telerik Data Access
. For more information on the new names, please, check out the Telerik Product Map