I created a module to be included in the main MVC3 web application. The module is packaged in a NuGet package and can be installed and uninstalled using NuGet. Both the main site and the module use Code First, EF> = 4.3
To create the package, I have one more MVC3 site, and all the functions are inside the scope, so to create the package I just collect libraries, views and all the necessary files. Database migrations work great in a project, and the package is created beautifully.
Now I install the package on the main site through NuGet. This site is in a different solution, and the solution has two projects:
- MyProject.Web.UI: This is an Mvc3 Project
- MyProject.EntityFramework: this is a class library with all models, dbContext for MyProject ...
The package is installed correctly, and the areas, areas, and libraries are installed correctly.
Now the problem is how do I update the database? I tried to run "Update-Database" first, but I get a message:
"The migration configuration type 'MyProject.Web.UI was not found in the assembly. (In Visual Studio, you can use the Enable-Migrations command from the package manager console to add migration).
I tried to enable migration using "Enable-Migrations", but I got this different message:
"No context type was found in assembly" MyProject.Web.UI ".
I also tried to start the site and see if the changes are automatically applied, but I get a page with a typical message:
"The model supporting the" NugetPackageDbContext "context has changed since the database was created. Consider using the First Code Migrations to update the database"
I do not know what to do to update the database with the necessary changes in migration, which are included in the NuGet package. Could anyone refresh here on this issue? I'm new to Migrations, maybe there are some configs for updating the database, if there are changes, instead of running commands in the console, I lost a little.
Thank you in advance:)