Subclass of Subclass fluent nHibernate

Posted by Xavier Hayoz on Stack Overflow See other posts from Stack Overflow or by Xavier Hayoz
Published on 2009-12-16T16:12:59Z Indexed on 2010/04/28 13:33 UTC
Read the original article Hit count: 550

Filed under:

Hi all

My model looks like this:

public class SelectionItem : BaseEntity // BaseEntity ==> id, timestamp stuff
{//blabla}

public class Size : SelectionItem
{//blabla}

public class Adultsize : Size
{//blabla}

I would like to use class-hierarchy-per-table-method of fluent nhibernate

public class SelectionItemMap : BaseEntityMap<Entities.SelectionItem.SelectionItem>
{
    public SelectionItemMap()
    {
        Map(x => x.Name);
        Map(x => x.Picture);
        Map(x => x.Code);
        DiscriminateSubClassesOnColumn("SelectionItemType");
    }
}

and reset a DiscriminateSubClassesOnColumn on the following subclass:

public class SizeMap : SubclassMap<Size>
{
    DiscriminateSubClassesOnColumn("SizeType")
}

public Adultsize : SubclassMap<Adultsize>
{}

But this doesn't work.

I found a solution on the web: link text but this method is depreciated according to resharper.

How to solve it? thank you for further informations.

© Stack Overflow or respective owner

Related posts about fluent-nhibernate