I have the following entity and Fluent NHibernate mapping:
public class Advertiser
{
public virtual int AdvertiserId { get; set; }
public virtual string AdvertiserName { get; set; }
public virtual bool IsPriorityEntity { get; set; }
}
public class AdvertiserMapping : ClassMap<Advertiser>
{
public AdvertiserMapping()
{
Id(a => a.AdvertiserId).GeneratedBy.Identity();
Map(a => a.AdvertiserName);
}
}
The IsPriorityEntity property is stored in the database by the existence of a row in the PriorityEntity Table.
The query looks something like:
Select
AdvertiserId,
AdvertiserName,
CASE WHEN pe.PriorityEntityID IS NOT NULL
THEN 1
ELSE 0 END as IsPriorityEntity
From Advertisers adv
Left Join PriorityEntity pe
on pe.PriorityEntityID = adv.AdvertiserID
and pe.EntityTypeID = 6
I am at a loss as to how to map something like this.