我想创建包含用户身份 GUID 的表(SQL Server)并在 Fluent NHibernate 中引用它,这是我的模型:
public class Invoice {
public virtual Guid Identity { get; set; }
public virtual MembershipUser User { get; set; }
public virtual int Price { get; set; }
}
所以映射应该是:
public class InvoiceMap : ClassMap<Invoice> {
public InvoiceMap() {
Id(x => x.Identity).GeneratedBy.GuidNative();
Reference(x => x.User).Column("User");
Map(x => x.Price);
Table("invoices");
}
}
但问题只有一个。该类MembershipUser
也应该被映射。
没有映射我怎么能做到这一点MembershipUser
?