title: Entity Framework Multiple EDMX file sharing same tables
body: <p><strong>Environment</strong> : EF 6, SQL 2012</p>
  
  <p><strong>Setup</strong>: Database First, LazyLoading disabled</p>
  
  <p>The question might appear more generic but will try to explain it in the best possible way.</p>
  
  <p>I have a large application using ASP.NET MVC and grouped the entity based on the logical functionality. Hence we built multiple EDMX files</p>
  
  <p>There is scenario in which we have to use the similar entity in two EDMX file.</p>
  
  <p><code>School</code> has relation to <code>Teachers</code> and <code>Students</code>.In first EDMX file, i used <code>school</code> and <code>Teachers</code>.In Second EDMX file, i used <code>school</code> and <code>students</code></p>
  
  <p>But only one Entity class getting created. If i run the custom tool on second EDMX context file, then the entity<code>(school.cs)</code> on my first edmx getting disappeared and it appears on the second one..</p>
  
  <ul>
  <li>Why this strange behaviour occurs?</li>
  </ul>
  
  <p>Here is the code in my first EDMX file</p>
  
  <p>As you see here, i m not accessing <code>school</code> entity and also i disabled Lazyloading. But it complains that it couldnt find <code>school</code> file. Note: Courses has navigation property to school. But i didnt include it here.. <strong>Why its occuring so?</strong></p>
  
  <pre><code> var courses= DB.courses
                                          .AsNoTracking()
                                          .Select(e =&gt;
                                              new CourseDTO()
                                              {
                                                  CourseID= e.CourseID,
                                                  Name= e.CourseName,
                                                  Desc= e.Desc,
                                                  isActive= e.isActive
                                              })
                                          .OrderBy(e =&gt; e.CourseID);
  </code></pre>
  
  <p>The problem is, I m able to include one entity in the EDMX file only..
  In first EDMX, it has navigation property to Teachers
  In second EDMX , it has navigation property related to Students. But only Entity file exists at a time.. With only one Entity file, the code breaks 
  Note: This is just sample..Not my original application</p>