Elenco mappe < Int32 > usando Fluente Nhibernate
-
06-07-2019 - |
Domanda
Devo mappare Elenco < Int32 > utilizzando Fluor Nhibernate.
Codice di esempio:
public class ReportRequest
{
public List<Int32> EntityIds
{
get { return entityIds; }
set { entityIds = value; }
}
}
Per favore guida.
Grazie!
Soluzione
L'ho implementato come:
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();
}
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow