Mapa List usando Fluent Nhibernate
-
06-07-2019 - |
Pergunta
Eu preciso mapear List
Exemplo de código:
public class ReportRequest
{
public List<Int32> EntityIds
{
get { return entityIds; }
set { entityIds = value; }
}
}
Por favor, guia.
Obrigado!
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