Let's say you have the following table structure:
==============================
| Case |
==============================
| Id | int |
| ReferralType | varchar(10) |
+---------| ReferralId | int |---------+
| ============================== |
| | |
| | |
====================== ====================== ======================
| SourceA | | SourceB | | SourceC |
====================== ====================== ======================
| Id | int | | Id | int | | Id | int |
| Name | varchar(50) | | Name | varchar(50) | | Name | varchar(50) |
====================== ====================== ======================
Based on ReferralType ReferralId contains id for SourceA, SourceB or SourceC
I am trying to figure out how to do this using Fluent NHibernate or just NHibernate in the object model. I tried a bunch of different things, but I was not successful. Any ideas?
An object model might be something like this:
public class Case
{
public int Id { get; set; }
public Referral { get; set; }
}
public class Referral
{
public string Type { get; set; }
public int Id { get; set; }
public string Name { get; set; }
}
source
share