title: NHibernate: (one or zero) to (one or zero) mapping
body: <p>I have two entities, <code>Foo</code> and <code>Bar</code> like so:</p>
  
  <pre><code>public class Foo
  {
      public virtual Guid FooID { get; set; }
      public virtual Bar MyBar { get; set; }
  }
  
  public class Bar
  {
      public virtual Guid BarID { get; set; }
      public virtual Foo MyFoo { get; set; }
  }
  </code></pre>
  
  <p>both of these entities can exist independently of each other, but on occasion they are related and when that happens I want to make sure they are linked in the persistence layer.</p>
  
  <p>I want my tables to resemble this:</p>
  
  <pre><code>create table Foo (
      FooID int primary key,
      -- other stuff
  );
  
  create table Bar (
      BarID int primary key,
      FooID int null references Foo(FooID) on delete no action on update no action
  );
  </code></pre>
  
  <p>...and for NHibernate to be able to create the relationship between them.</p>
  
  <p>How would I map this (XML preferred)?</p>