FluentNHibernate映射子类图

时间:2018-08-23 11:23:00

标签: c# nhibernate fluent-nhibernate

请帮助编写正确的映射。

版本dll:

FluentNHibernate Версия (2.0.3.0)
NHibernate Версия (4.1.0.4000)

MSSql表:

Union [int Id (PK)]
Plan [int Id (PK, FK)]

public class Union
{
    public virtual int Id { get; set; }
    public virtual string Name { get; set; }
}
public class UnionMap : ClassMap<Union>
{
    public UnionMap()
    {
        Schema("dbo");
        Table("Union");

        Id(p => p.Id).Column("Id");
        Map(p => p.Name).Column("Name");
    }
}

public class Plan : Union
{
     public virtual int Shifr { get; set; }
}
public class PlanMap : SubclassMap<Plan>
{
    public PlanMap()
    {
        Schema("dbo");
        Table("Plan");

        Map(p => p.Shifr).Column("Shifr");
    }
}

运行BuildSessionFactory()命令时,收到错误消息“重复的类/实体映射ConsoleApplication1”错误。计划”

0 个答案:

没有答案