title: Many to Many relationship with Fluent NHibernate
body: <p>I'm getting the following error: "Can't figure out what the other side of a many-to-many should be."
  Team Entity:</p>
  
  <pre><code>public class Team : IEntity
  {
      public int Id { get; set; }
  
      public string Name { get; set; }
  
      public IList&lt;Employee&gt; Employee { get; set; }
  
      public Team()
      {
          Employee = new List&lt;Employee&gt;();
      }
  }
  </code></pre>
  
  <p>Employee Entity:</p>
  
  <pre><code>public class Employee : IEntity
  {
      public int Id { get; set; }
  
      public String LastName { get; set; }
  
      public string FirstName { get; set; }
  
      public IList&lt;Team&gt; Team { get; set; }
  
      public string EMail { get; set; }
  
      public Employee()
      {
          Team = new List&lt;Team&gt;();
      }
  }
  </code></pre>
  
  <p>Team mapping:</p>
  
  <pre><code>public class TeamMap : ClassMap&lt;Team&gt;
  {
      public TeamMap()
      {
          // identity mapping
          Id(p =&gt; p.Id);
  
          // column mapping
          Map(p =&gt; p.Name);
  
          // relationship mapping
          HasManyToMany&lt;Employee&gt;(m =&gt; m.Employee);
      }
  }
  </code></pre>
  
  <p>Employee mapping:</p>
  
  <pre><code>public class EmployeeMap : ClassMap&lt;Employee&gt;
  {
      public EmployeeMap()
      {
          // identifier mapping
          Id(p =&gt; p.Id);
  
          // column mapping
          Map(p =&gt; p.EMail);
          Map(p =&gt; p.LastName);
          Map(p =&gt; p.FirstName);
  
          // relationship mapping
          HasManyToMany&lt;Team&gt;(m =&gt; m.Team);
      }
  }
  </code></pre>
  
  <p>Nobody has an answer? </p>
  
  <p>Edit: The error occurs on the following code:</p>
  
  <pre><code>public static ISessionFactory CreateSessionFactory()
  {
      return Fluently.Configure()
          .Database(MsSqlConfiguration.MsSql2008
          .ConnectionString(c=&gt;
              c.Database("Ariha")
              .TrustedConnection()
              .Server("localhost")
              ).ShowSql())
          .Mappings(m =&gt; m.FluentMappings
              .AddFromAssemblyOf&lt;BookMap&gt;()
              .AddFromAssemblyOf&lt;MagazineMap&gt;()
              .AddFromAssemblyOf&lt;EmployeeMap&gt;()
              .AddFromAssemblyOf&lt;TeamMap&gt;())
          .ExposeConfiguration(BuildSchema)
          .BuildSessionFactory();
  }
  </code></pre>
  
  <p>edit: here the whole solution: <a href="http://rapidshare.com/files/309653409/S.O.L.I.D.Ariha.rar.html" rel="nofollow noreferrer">http://rapidshare.com/files/309653409/S.O.L.I.D.Ariha.rar.html</a></p>