title: Fluent NHibernate - HasOne With Where Clause
body: <p>with Fluent NHibernate i can map a one to many relationship against my User class by saying:</p>
  
  <pre><code>HasMany(x =&gt; x.Membership)
      .KeyColumn("UserID")
      .Where("Deleted = 0");
  </code></pre>
  
  <p>This works as expected that it only grabs the Membership records which have not been deleted. No say i have a field called Latest against the Membership where i know this would return one record per user, i'd like to be able to say:</p>
  
  <pre><code>HasOne(x =&gt; x.CurrentMembership)
      .Where("Current = 1");
  </code></pre>
  
  <p>But there is no Where method. I know i could do this in code by saying:</p>
  
  <pre><code>public virtual Membership CurrentMembership
      { get { return Membership.Single(m =&gt; m.Current); } }
  </code></pre>
  
  <p>But this doesn't allow me to do LINQ queries against this property. I'd just accepted this as a limitation in the past but it really is starting to bite me in terms of performance.</p>
  
  <p>I'd really appreciate it if someone could help.</p>