title: Setting up one to many relationship with Fluent Nhibernate
body: <p>I'm having a bit of an argument with my co-worker that I can't seem to find an answer to yet this is very basic stuff.</p>
  
  <p>Establishing one-to-many relationship in Fluent Nhibernate entity.</p>
  
  <p>Let's take Roles and users for example. A role can be assigned to multiple users so I made my entity guts looks like:</p>
  
  <pre><code>public class User
  {
      [Required]
      public virtual string FirstName { get; set; }
      public virtual Role Role { get; set; }
  }
  </code></pre>
  
  <p>and role</p>
  
  <pre><code>public class Role
  {
      [Required]
      public virtual string Name { get; set; }
      public virtual IList&lt;User&gt; Users{ get; set; }
  
      public Role()
      {
          Users = new List&lt;Users&gt;();
      }
  }
  </code></pre>
  
  <p>As you can see I'm referencing a collection of Users in roles, kind of saying that each role will have multiple users. User entity has that Role entity reference needed to identify what Role does a user belong to.</p>
  
  <p>In my opinion this is the correct way to link and my co-worker says that having a <code>Role</code> reference for users will create a circular reference. Who's right ?</p>
  
  <p>I tried finding the answer online. I think this question tells me that I'm right:
  <a href="https://stackoverflow.com/questions/2472897/fluent-nhibernate-many-to-one-mapping">Fluent NHibernate Many to one mapping</a></p>
  
  <p>But then I looked at a Fuent Nhibernate sample project here
  <a href="https://github.com/jagregory/fluent-nhibernate/tree/master/src/Examples.FirstAutomappedProject/Entities" rel="nofollow noreferrer">https://github.com/jagregory/fluent-nhibernate/tree/master/src/Examples.FirstAutomappedProject/Entities</a> and I don't an example of what I'm trying to implement.
  Can you guys advise or help me find a document explaining the correct way ? Am I right?
  Thank you.</p>