Fluent NHibernate - How to map a List<enum>?

Viewed 3355

I have a class and inside it, a string and a list of enumerators.

public enum SomeEnum
{
    Undefined=0,
    Enum1,
    Enum2,
    Enum3,
    End
}
public class SomeObject
{
    public virtual int ID{get; set;}
    public virtual String Name {get; set;}
    public virtual IList<SomeEnum> EnumList {get; set;}
}

Now, there should be a list of SomeObjects, containing ID and Name. There should be another map like this:

5 2
5 3
3 1
9 3

Meaning, a player with ID 5 has Enum2 and Enum3, another player with ID 3 has Enum1, and a player with ID 9 has Enum3. They say it's possible to map int, float etc. but I don't want to create IList out of my list.

Is there an easy way to make fluent nhibernate do that?

HasMany(x => x.EnumList )
    .Cascade.All()
    .Table("ObjectEnumTable");

This mapping file throws an exception and says "Association references unmapped class: SomeEnum".

Thanks in advance.

2 Answers
Related