Hi,
We are migrating an existing application and we want to handle all NHibernate classes / mappings in a uniform way. In the database, (allmost) all tables have the same base-fields, that is a primary key, a version and a tenantid. In .NET we created a base class with these fields, all real classes derive from this class, like:
class Entity { public int Id; public int Version; public int TenantId }
class Table : Entity { // Table specific fields go here }
We create mapping for all real-classes, but for now we have to specify these Entity-attributes explicitely in every class-mapping, like e.g.
<class name="Table" table="Table">
<id name="Identity" type="int" column="Id"> <generator class="identity"/> </id>
<version column="Version" name="Version" access="property" unsaved-value="negative" />
<property name="Tenant"> <column name="TenantID" not-null="true" /> </property> <!-- other properties go here --> </class>
My question: is it possible to extract the lines marked in blue and import them in every real-table mapping?
Any hints are greatly appreciated
Kind regards, Martin de Jong the Netherlands
|