title: fluent nhibernate parent child mapping
body: <p>I have a problem with FluentNHibernate when I try to map a nested parent-child relationship.
  When I try a query like this: </p>
  
  <pre><code>var courier = session.Query&lt;Courier&gt;().FirstOrDefault(x =&gt; x.Code == "X"); 
  </code></pre>
  
  <p>the DistributionCenter property in CourierPrice contains CourierPrice entities for all possible couriers, not only X. Is it possible to change this behavior without modifying the mappings?</p>
  
  <pre><code>public class Courier
  {
    public Courier()
    {
      Courierprices = new List&lt;Courierprice&gt;();
    }
    public virtual System.Guid Guid { get; set; }
    public virtual string Code { get; set; }
    public virtual IList&lt;Courierprice&gt; Courierprices { get; set; }}
  }
  public class Courierprice 
  {
    public virtual System.Guid Guid { get; set; }
    public virtual Courier Courier { get; set; }
    public virtual Distributioncenter Distributioncenter { get; set; }
    public virtual decimal? Price { get; set; }
  }
  public class Distributioncenter
  {
    public Distributioncenter()
    {
      Postcodes = new List&lt;Postcode&gt;();
    }
    public virtual System.Guid Guid { get; set; }
    public virtual string Code { get; set; }
    public virtual IList&lt;Courierprice&gt; Courierprices { get; set; }
  }
  </code></pre>
  
  <p>Mapping:</p>
  
  <pre><code>public CourierMap()
  {
    Table("Couriers");
    LazyLoad();
    Id(x =&gt; x.Guid).GeneratedBy.Assigned().Column("Guid");
    Map(x =&gt; x.Code).Column("Code");
    HasMany(x =&gt; x.Courierprices).KeyColumn("Courier");
  }
  public CourierpriceMap()
  {
    Table("CourierPrices");
    LazyLoad();
    Id(x =&gt; x.Guid).GeneratedBy.Assigned().Column("Guid");
    References(x =&gt; x.Courier).Column("Courier");
    References(x =&gt; x.Distributioncenter).Column("DistributionCenter");
    Map(x =&gt; x.Price).Column("Price");
  }
  public DistributioncenterMap()
  {
    Table("DistributionCenters");
    LazyLoad();
    Id(x =&gt; x.Guid).GeneratedBy.Assigned().Column("Guid");
    Map(x =&gt; x.Code).Column("Code");
    HasMany(x =&gt; x.Courierprices).KeyColumn("DistributionCenter");
  }
  </code></pre>