Fluent NHibernate Map Enum as Lookup Table
- by Jaimal Chohan
I have the following (simplified)
public enum Level
{
Bronze,
Silver,
Gold
}
public class Member
{
public virtual Level MembershipLevel { get; set; }
}
public class MemberMap : ClassMap<Member>
{
Map(x => x.MembershipLevel);
}
This creates a table with a column called MembershipLevel with the value as the Enum string value.
What I want is for the entire Enum to be created as a lookup table, with the Membe table referencing this with the integer value as the FK.
Also, I want to do this without bas***izing my model.
Any ideas?
[And I want time machine]
[With 2 cup holders]