title: EF code first modular design
body: <p>Using ef4 code first you can create and compile classes and dbcontext. What happens when you want to add some classes/tables and relationships in an already compiled dll of a model set?</p>
  
  <p>So far the solutions I have come up with are using "partial" classes, that would be complimented later on, and the second one is writing a whole new dbcontext that includes the first one in some way or extending it, but this would mean additional db connection per module (per db context). Any ideas about this? What's the best practice ? Also I need to be able to work with migrations.</p>
  
  <p>More explicitly, a possible scenario is as follows:</p>
  
  <p>A) You create a .dll with some dbContextBase class and tables(classes) inside that.</p>
  
  <p>B) You create other .dlls that depend/extend dbContextBase in their own way*</p>
  
  <p>C) You refference said .dlls in a project and extend them.</p>
  
  <p>So basically you can have a core dbContext, then add a menu module to it, then you add a blog module to it (but it can be seen by the Menu module in order to create latest blog posts menus etc). On top of that, if you want a specific one-time feature for blog you can quickly integrate that, but also keep your blog module updateable.</p>
  
  <p>As I beggin to see it the best way to do that is Nuget packages with the source code for the models (and the like) per module, instead of compiled dll.</p>