I have a [ContactNumbers]
table as defined below:
ID (PK) | PersonID (FK) | NumberType | Number
========|===============|============|=======
and a classes defined as:
public class Person
{
ContactNumber homePhone;
ContactNumber workPhone;
}
public class ContactNumber
{
string Number;
}
How would I define my HBM mapping/s for the Person
and ContactNumber
class so that Person.homePhone
is mapped to the corresponding row in the [ContactNumbers]
table with the FK observed, and [ContactNumbers].[NumberType]
equal to "HOME"
? ([NumberType]
is "WORK"
for Person.workPhone
.)
Already spent a good deal of the day just looking into this, and I couldn't find a solution just yet.