I hope you can help with my scenario. I have two db tables. The first one is called status and does not change. It contains two columns, one for the ID and another called status which contains the values "Queued", "In Process" "Treated"
The second table is called Activity and uses a FK to constrain the status of an activity
Using fluent Nhibernate, if i want to insert a new row into Table.Activity do i need to reference the entity(table) 'status' in the entity Activity and associated mapping, for example:
public virtual Status Status { get; set; } // Activity Entity Class
References(a => a.Status); // Activity Mapping Class
And if i did that then how would I save the new session
session.Save(new Activity
{
Name = "Activity A1DD",
Status = new Staus { ID = 1 } // But can't do that cause its expecting an object
}
The alternative I can see is just to represent the FK as an integer and create an enum class that represents this table and don't worry about the relationship using fluent?
Thanks
GB