我不確定什麼是價值。
// InvoiceTypeMap : ClassMap<InvoiceType>
public InvoiceTypeMap()
{
Table("dictionaryTable");
Where("typeid=5");
Map(it => it.SomeProperty, "value");
}
// PaymentTypeMap : ClassMap<PaymentType>
public PaymentTypeMap()
{
Table("dictionaryTable");
Where("typeid=3");
Map(it => it.SomeOtherProperty, "value");
}
void SetInvoiceTypeToEntity(Invoice invoice, int invoicetypeid)
{
invoice.Invoicetype = session.Get<InvoiceType>(invoicetypeid);
// or when you only need the Reference without the actual object here
invoice.Invoicetype = session.Load<InvoiceType>(invoicetypeid);
}