Change column for joined class mapping in Fluent NHibernate Automapping
I have an inheritance
public abstract class UserEntity : Entity
{
public virtual int Id { get; pr开发者_StackOverflowotected set; }
}
public class Employee : UserEntity
{
public virtual string Email { get; set; }
}
Entity is a standard for NH class where overridden methods Equals, GetHashCode, etc. And I use AutMap rewriting .IncludeBase()
I got with Fluent NHibernate Automapping
<class xmlns="urn:nhibernate-mapping-2.2" name="Dto.Entities.UserEntity" table="UserEntities">
<id name="Id" type="System.Int32">
<column name="Id" />
<generator class="identity" />
</id>
<joined-subclass name="Dto.Entities.Employee" table="Employees">
<key foreign-key="FK_Employee_UserEntity">
<column name="UserEntityId" />
</key>
<property name="Email" type="System.String">
<column name="Email" />
</property>
</joined-subclass>
</class>
I want to change name for key column in joined subclass from UserEntityId to EmployeeId
I try
public class UserEntityOverride : IAutoMappingOverride<UserEntity>
{
public void Override(AutoMapping<UserEntity> mapping)
{
mapping.JoinedSubClass<Employee>("EmployeeId");
}
}
but didn't have success.
I use the latest for this moment FNH from NuGet package: FluentNHibernate 1.2.0.712. Also I have much more configuration and conventions that can somehow affect on this configuration ignoring, but I have tried it on a clear solution with the same negative result.
精彩评论