开发者

How to automap Table-per-class hierarchy in S#arp architecture

I am pretty new to S#harp architecture and fluent nhibernate. I was trying to build a sample solution using the template. MappingIntegrationTest fails for me when I try to run it for the following domains

public class Component
{
  public virtual string comp { get; set; }
}

public class Parent : Entity
{
   public virtual string Type { get; set; }
}

public class Child1: Parent
{
   public virtual Component Blah { get; set }
}

The ParentMap looks like following:

public class ParentMap : IAutoMappingOverride<Parent>
{
    public void Override(AutoMapping<Parent> mapping)
    {
        mapping.DiscriminateSubClassesOnColumn("Type")
            .SubClass<Child1>(m =>
                            {
                               m.Component(c => c.Blah, c =>
                                    {
                                        c.Map(x => x.comp , "comp");
                                    }
                            }
    }
}

The mapping integration tests fail for me * Database was not configured through Database method.

----> NHibernate.MappingException : An association from the table Parent refers to an unmapped class: Compon开发者_运维百科ent

Do I need to remove these classes from AutoMapper?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜