Search code examples
entity-frameworkprismmef

Prism EntityFramework Mef Partial Class Context not generating table


I have a Prism project with several modules. Using EF code first for generating the database.

I am trying to build the context using partial class. For each module will have its partial class context (one context whole solution).

I am using the same namespace for each module to create the context. However, when initializing the database, only the tables defined in the main module is created, but not the others.

Is there anything I could look for or is there a better way? Tks.


Solution

  • All parts of partial class must be in the same assembly (in your case probably in the same module) because it is just syntactic sugar to divide single file (class) into multiple parts but these parts are concatenated during build. Partial classes will not help you to achieve modularity (if you expect to add or remove modules to deployed application).