Question

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?

Was it helpful?

Solution 2

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

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

More info here.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top