Using Sharp Architecture 1.9

I have a base class that inherits from the Sharp Arch Entity class

public class LineItem : EntityWithTypedId<Guid>
{
  // various properties
}

and then two classes that inherit:

public class BasketItem : LineItem { public virtual Basket Basket; ...}
public class OrderItem : LineItem { public virtual Order Order ...}

In my database I have two tables. BasketItems and OrderItems.

My problem: Fluent NHibernate (AutoMapping) is trying to map LineItem.

My question: How do I tell NHibernate to ignore the LineItem mapping given that I still want to map the EntityWithTypedId property to the BasketItems and OrderItems table?

有帮助吗?

解决方案 2

The solution was to add code like this to my automap configuration:

AutoMap.AssemblyOf<Entity>(cfg)
  .IgnoreBase<Entity>();

More info here.

其他提示

it depends on what the table structure of the basketitem and orderitem are. Are you using the table per concrete class or table per class hierarchy?

Inheritance Mapping with Fluent NHibernate

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top