views:

206

answers:

1

Hello there,

I need to map List<Int32> using Fluent Nhibernate.

Sample code:

public class ReportRequest
{
    public List<Int32> EntityIds
    {
        get { return entityIds; }
        set { entityIds = value; }
    }
}

Please guide.

Thank you!

A: 

I have implemented it as :

public class ReportRequestMap : ClassMap<ReportRequest>
{
    public ReportRequestMap()
    {
        Id(x => x.Id).UnsavedValue(null).GeneratedBy.Native();        
        HasMany(x => x.EntityIds).Table("ReportEntities").KeyColumn("ReportRequestId").Element("EntityId").AsBag();
    }
}
inutan