我如何能够用两列非键映射另一个对象内部的对象?
public class Car
{
public virtual int Id { get; set; }
public virtual int AccountId { get; set; }
}
public class UserAccount
{
public virtual int Id { get; set; }
public virtual int UserId{ get; set; }
public virtual int AccountId { get; set; }
}
public class User
{
public virtual int Id { get; set; }
public virtual int Name { get; set; }
}
假设我想获得所有用户名为“joe”的汽车。我将如何使用流利的 nhibernate 映射/查询这些?
public Car()
{
Table("Car");
Id(x => x.Id).Column("ID").GeneratedBy.Native();
Map(x => x.AccountId);
References(x => x.Account); // ?? needs to map accountid with the Account.Id...
}