title: Entity Framework, Code First. How override generation up/down script
body: <p>I use bounded contexts (BC) with EF Code-first in my solution to generate database.</p>
  <p>Some tables are partially (not with all fields) defined as classes in distinct BC's to add a foreign key for dependent tables, but there is always a BC with a class that defines table with all fields by single class.</p>
  <p>I didn't find a way to generate a single migration based on multiple contexts, so I had to add multiple migrations. But in each migration EF adds all the changes in all classes in BC, including partially defined tables. The biggest problems are:</p>
  <ul>
  <li>when I add a partial table, EF wants to add a new table to DB, which
  already exists</li>
  <li>when I need to remove a field only in one class to which table is
  mapped only partially, it wants to remove a field from a table in
  database, which ruins other classes.</li>
  </ul>
  <p>The project that I'm working has a dozen odd developers, more than 350 tables, and more than 20 BC's, so changing scripts that are generated by EF Migration by hands sounds like madness.</p>
  <p>It seems like the only way to solve it - is to alter the migration pipeline to exclude the creation or alternation of tables defined by classes that marked with specific attribute.</p>
  <p>So, is there any other way to solve my problem, or should I hack in the EF source code and inject the bypass routine there?</p>