2009-07-13 16 views
2

私は場所を表すオブジェクトを持っています。場所には他の場所を含めることができます。どのようにしてFluent NHibernateとこの関係を表現できますか?クラスは次のようになります。流暢なNHibernate - 再帰的なマップ

public class Location : EntityBase 
{ 
    #region Properties 
    public string LocationName { get; set; } 
    public Location ParentLocation { get; private set; } 

    private List<Location> _locations = new List<Location>(); 
    public IEnumerable<Location> Locations 
    { 
     get { return _locations; } 
    } 

    private List<Device> _devices = new List<Device>(); 
    public IEnumerable<Device> Devices 
    { 
     get { return _devices; } 
    } 

    #endregion 
    //Other logic omitted 
} 

ありがとうございます。

+0

あなたの現在のマッピングは何ですか? HasManyToMany(map => map.Locations)が動作しないのはなぜですか? – Paco

+0

@Paco:プロパティLocateにはFluent NHibernateで作業するためのセッターが必要です。 –

答えて

0

その可能性を得るために、民間分野

HasManyToMany(Member.Reveal<Location>("_locations"))