Mapping collection of enum in NHibernate
I have a class with collection of enums:
Class1.cs
public enum Language
{
Serbian = 1,
Croatian,
Ukrainian,
}
public class Class1
{
private IList<Language> m_languages = new List<Language>();
public virtual IList<Language> Languages
{
get { return m_language开发者_JAVA百科s; }
set { m_languages = value; }
}
}
What is the content of mapping file for this class?
As an alternative, you may want to consider something a little 'smarter' than enums; take for instance Fabio's Well Known Instance Type example - I find myself using these all the time for (relatively) static data.
Google is your friend: http://www.lostechies.com/blogs/sean_chambers/archive/2008/04/06/mapping-an-collection-of-enums-with-nhibernate.aspx
精彩评论