Fluent NHibernate Map Enum as Lookup Table
Posted
by Jaimal Chohan
on Stack Overflow
See other posts from Stack Overflow
or by Jaimal Chohan
Published on 2010-04-02T20:02:41Z
Indexed on
2010/04/05
22:03 UTC
Read the original article
Hit count: 1058
fluent-nhibernate
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]
© Stack Overflow or respective owner