title: EF Code first - many to many relation mapping table with extra columns
body: <p>I am having a User Model and and a Group Model.  User and Group share a many to many relationship. In when I translate this to table, I want to have a mapping table. I am using the following to achieve this.</p>
  
  <pre><code>modelBuilder.Entity&lt;UserGroup&gt;()
          .HasMany(a =&gt; a.Users)
           .WithMany(b =&gt; b.UserGroup)
  
           .Map(mc =&gt;
           {
  
               mc.ToTable("UserUserGroupMapping");
               mc.MapLeftKey("UserId");
               mc.MapRightKey("UserGroupId");
  
           });
  </code></pre>
  
  <p>This creates a table with UserId and UserGroupId as columns. However I have few challenges,</p>
  
  <p>I would like to be able to add an Identity column to this table and some audit columns (ex: Created by, created date) to the table. I am not sure how to do this.</p>
  
  <p>Can any one help me here?</p>
  
  <p>Thanks</p>