Pergunta

Eu preciso mapear List usando Fluent Nhibernate.

Exemplo de código:

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

Por favor, guia.

Obrigado!

Foi útil?

Solução

Eu implementei-o como:

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();
    }
}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top