title: Fluent NHibernate - one to at most one (1 – 0..1) Relationship
body: <p>Im just trying to work out if its possible to map a 1 - 0..1 (one to at most one \ one to zero or one) relationship using fluent NHibernate without the use of a Private Collection.  An example of the class structure is below:  </p>
  
  <pre><code>    public class ClassA
      {
          public int ClassAId { get; set; }
  
          public string SomeDetails { get; set; }
  
          public ClassB ClassB { get; set; }
  
      }
  
      public class ClassB
      {
          public ClassA ClassA { get; set; }
  
          public int ClassBId { get; set; }
  
          public string SomeChildDetails { get; set; }
      }
  </code></pre>
  
  <p>In this example, ClassA can have a ClassB, or ClassB can be null.</p>
  
  <p>The DB structure would look something like:</p>
  
  <pre><code>   ClassA Table
     -------------
     int ClassA_ID  PK
     string SomeDetails
  
     ClassB Table
     ------------
     int ClassA_Id   PK  FK
     string SomeChildDetails
  </code></pre>
  
  <p>In this situation, you cannot use HasOne(x => x.ClassB).Cascade.All(); as this assumes it must always have one.</p>
  
  <p>Is there a way to do this without having a one to many relationship with a private IList on ClassA and having the getter of the ClassB property getting the first entry in the list.</p>
  
  <p>Ta</p>
  
  <p>R</p>