You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My Server model (DB) is separated on various contexts about 5-7 on separated dll's (packages).
The server models will be stored in nuget. So the contexts and configurations of EF API will be stored there too.
I want to run the migrations on my web project(s) that references the packages.
The contexts could target one DB or multiples from various projects.
Earlier those issues can be resolved by storing particular dlls and running migrate.exe on them. So, the defined migrations in these dll's ran.
How could i use dotnet ef tool on the particular package to do the migrations defined in the particular package?
Steps to reproduce
Create 3 packages with DbContext and some sample classes.
Add migrations to all of them.
Publish them on Nuget or other Nuget based feed.
Create new web project.
Add the packages.
Try to Run migrations on the contexts defined in the packages.
Probable Workaround
Somehow execute the dotnet ef on dll that is stored in default nuget packages directory...
[if there is no solution] Design Suggestions.
I can see two possible solutions for multiple contexts, that are used to define the various databases(my case):
Define Migrations only in Web Project (or other project that is the entry point that require Db usage)
Define required Migrations on every package (as it is now defined for me)
[if there is no solution] Suggested probable solutions
Scan solution references to determine if there somewhere the inherited class from DbContext defined and let use(list) it if we run dotnet ef commands for the web project.
Allow dotnet ef to run based on installed package. Just to target the package that has the particular context.
Let dotnet ef to execute builded dll's like My.Models.dll. (More a workaround for me)
Find another way to determine contexts in packages :)
The text was updated successfully, but these errors were encountered:
dotnet-ef currently requires a project.json file; it can't be used on assemblies directly.
If the DbContext types have been added to the consuming web app's services using IServiceContainer.AddDbContext<T>(), you should be able to call dotnet ef database update as you would on any other DbContext.
We also have issue #646 which is a tool more similar to migrate.exe which can work directly with assemblies.
The issue
@natemcmaster could you advise on following:
Earlier those issues can be resolved by storing particular dlls and running migrate.exe on them. So, the defined migrations in these dll's ran.
How could i use dotnet ef tool on the particular package to do the migrations defined in the particular package?
Steps to reproduce
Probable Workaround
Somehow execute the dotnet ef on dll that is stored in default nuget packages directory...
[if there is no solution] Design Suggestions.
I can see two possible solutions for multiple contexts, that are used to define the various databases(my case):
[if there is no solution] Suggested probable solutions
The text was updated successfully, but these errors were encountered: