title: Creating Entity Model with Cross Referencing Table - EntityFramework 4.1
body: <p>Here is my scenario (tables):</p>
  
  <pre><code>Departments
  ====================
  Id (int)
  Name (varchar)
  
  Employees
  ====================
  Id (int)
  Name (varchar)
  
  EmployeesDepartmentXREFs
  ====================
  EmployeeId (int)
  DepartmentId (int)
  </code></pre>
  
  <p>When I import these 3 tables into EDMX model, I get 2 entities: Employee and Department. Entity Employee has navigational property Departments and entity Department has navigational property Employees.</p>
  
  <p>And this is all fine. I actually like it this way.</p>
  
  <p>But, problem starts when I want to add more fields in the XREF table, for example, I would like to have DateCreated, UserId fields to record when change is made and by who. If I add these two fields in XREF table, then my EDMX model will show 3 entities instead of two. It is not big issue, but since I am already done with coding, I am sort of looking for easy solution (to avoid coding).</p>
  
  <p>Question: <strong>Is it possible to add new fields into XREF (cross reference) table and to keep only two entities?</strong> If yes, how would I update my datetime and userid information?</p>
  
  <p>I assume that XREF entity has to be present in order to be able to update it (with date and user id), but I really like having navigational properties: <strong>Departments</strong> and <strong>Employees</strong>, versus having navigational properties <strong>EmployeesDepartmentXREFs</strong>.</p>
  
  <p>Is there a middle ground for this? What is the best practice?</p>
  
  <p>Thanks.</p>