我有三个表Person
,Address
和PersonAddressX
已为其创建映射:
[Class(Nametype = typeof(Person), Table = "Person"]
public class Person
{
[Id(-2, Name = "Id")]
[Generator(-1, Class = "native")]
public virtual long Id { get; set; }
[ManyToOne]
public virtual Address Address { get; set; }
}
[Class(NameType = typeof(Address), Table = "Address")]
public class Address
{
[Id(-2, Name = "Id")]
[Generator(-1, Class = "native")]
public virtual long Id { get; set; }
[Property]
public virtual string Street { get; set; }
}
[Class(NameType = typeof(PersonAddressX), Table = "PersonAddressX"]
public class PersonAddressX
{
[Id(-2, Name = "Id")]
[Generator(-1, Class = "native")]
public virtual long Id { get; set; }
[ManyToOne]
public virtual Person Person { get; set; }
[ManyToOne]
public virtual Address Address { get; set; }
}
在我的应用程序中,我有一个方法Repository<Address>
的{{1}},我想要从特定的GetPersonAddressX
中获取IList<PersonAddressX>
。使用当前映射,我无法做到这一点,因为它不是双向的。我尝试了一些双向映射的示例,但是结果查询返回Address.Id
。