Display a different view depending on the type of child

So, I have a situation where I have a common base type, but I need to map another view based on the child type.

It looks like I can use a generic mapping class to handle inheritance

http://geekswithblogs.net/nharrison/archive/2010/07/09/inheriting-a-class-map-in-fluent-nhibernate.aspx

But how can I conditionally display another view based on a child type? I see the EntityType property, but it says that it is deprecated and will be closed in the next version.

As an example, I have the ContactInfo base class, standard between contact types, but the values ​​come from different places depending on the type of contact, I will process this through the sql view.

0
source share
1 answer

using any mapping, the object referenced comes from another table

class ContactInfo
{
    public virtual long Id { get; set; }
    public virtual ContactDetails Details { get; set; }
}

public ContactInfoMap
{
    ...
    ReferencesAny(x => x.Details)
        .EntityIdentifierColumn("details_id")
        .EntityTypeColumn("contactType")
        .IdentityType<long>()
        .AddMetaValue<FooContactDetails>("1")
        .AddMetaValue<BarContactDetails>("4");
}
0
source

All Articles