Beta 7 - migrations from multiple dbcontexts not work
See original GitHub issueHello,
I have one DbContext in regular .NET Assembly (.NET 4.5.1) and one ApplicationDbContext (MVC 6 - Beta 7). On dnx ef migrations add NewDatabase
command get only the ApplicationDbContext.
My Startup.cs code is:
services.AddEntityFramework()
.AddSqlServer()
.AddDbContext<ApplicationDbContext>(options =>
{
options.UseSqlServer(Configuration["Data:DefaultConnection:ConnectionString"]);
})
.AddDbContext<DepositContext>(options =>
{
options.UseSqlServer(Configuration["Data:DefaultConnection:ConnectionString"]);
});
Have anyone a idea for this issue?
Thanks, Gregor
Issue Analytics
- State:
- Created 8 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
EF 7 Migrations with multiple DBContexts
I was looking for an answer to this question and wanted to provide my solution for ef core 2.0. Microsoft.EntityFrameworkCore.Tools.
Read more >Code First Migration in Multiple DbContext
In this tip, we will learn to migrate database when multiple DbContext is present in the same application.
Read more >Migrations with Multiple Providers - EF Core
One way to create multiple migration sets is to use one DbContext type per provider. ... Specify the context type when adding new...
Read more >Entity Framework Core Migrations
Today I'm going to cover how to do Entity Framework Core migrations in a .NET Core application through the command line and in...
Read more >Multitenancy in ASP.NET Core - Simplest Way to achieve ...
In this article, let's learn how to implement Multitenancy in ASP.NET Core in a rather simple way making use of Entity Framework Core....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You need to specify the
DbContext
using the--context
or-c
command line argument:The command line should actually throw an error like this if you have multiple database contexts in your project:
But I guess that the command line cannot find the context in that other assembly (note that you need to run
dnx
always from the root of the project; so if it’s in another project, you may have to cd there first), so it just sees the application one.Yes, #2294 is the high-level item.