开发者

Many to many as map in fluent Nhibernate

Is there a way to map a many-to-many relationship using Fluent NHibernate to a dictionary?

Say I have the following (totally just made up) tables:

Person ( Id INT, Name NVARCHAR(MAX) )

Address ( Id INT, StreetAddress NVARCHAR(MAX) )

PersonAddresses ( PersonId INT,

AddressId INT, AddressType NVARCHAR(MAX) )

public class Person
{
  public virtual int Id { get; set; }
  public virtual string Name { get; set; }
  public virtual IDictionary<string, Address> Addres开发者_运维技巧ses { get; set; }
}

I want to map the addresses of a person to a dictionary property on the person entity that has the addresses as values and the AddressType from the PersonAddresses-table as the key. Is this at all possible using fluent NHibernate, if not, is it possible using the xml configuration? The problem I'm facing is that the key-column I want to map is in the join-table rather than in the referenced table.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜