C# Fluent Nhibernate和可插拔继承

C# Fluent Nhibernate和可插拔继承,c#,inheritance,nhibernate,fluent,C#,Inheritance,Nhibernate,Fluent,是否有任何方法可以定义/扩展继承而不必使用Fluent NHibernate更改基表映射?例如,使用Castle.ActiveRecord(基于NHibernate),可以如下定义继承: [ActiveRecord("entity"), JoinedBase] public class Entity : ActiveRecordBase { [PrimaryKey] public int Id { get; set; } } [ActiveRecord("entitycomp

是否有任何方法可以定义/扩展继承而不必使用Fluent NHibernate更改基表映射?例如,使用Castle.ActiveRecord(基于NHibernate),可以如下定义继承:

[ActiveRecord("entity"), JoinedBase]
public class Entity : ActiveRecordBase
{ 
    [PrimaryKey]
    public int Id { get; set; }
}

[ActiveRecord("entitycompany")]
public class CompanyEntity : Entity
{
    [JoinedKey("comp_id")]
    public int CompId { get; set; }
}
  • 可以在不更改基本实体映射的情况下添加或删除新的子类
  • 调用
    Entity.FindAll()
    时,它将返回所有实体(以及继承的实体)

现在不行,不行。当然不需要对父类映射进行任何修改。

好的,我找到了方法,可以使用IClassConvention+IOC(带程序集扫描的结构映射)