-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrations script not using IDesignTimeDbContextFactory #25053
Comments
|
I'm also seeing this issue, except I'm not quite sure how to get around it.
I'm running my web server in a Topshelf service, and when trying to add migrations (.net 6 ef core) it starts my web app passing a bunch of arguments to it, and just stays running with no migrations created. |
Same problem with |
@replaysMike See #27306. |
Not sure in which EF/ASP.NET version this started happening in but our EF migrations have started facing this problem as well. We are still using the traditional web host builder in Program/Startup |
Not sure if I'm experiencing the same problem, but
|
I'm encountering this issue when I have the DbContext set to a scoped service. I get the following error.
I think that the |
i believe i run into the same issue. add-migration works, but remove-migration runs into sql connection timeout. |
Am facing the same problem in .net 8 has this not been resolved? |
Same here, my implementation of the IDesignTimeDbContextFactory is found but the DI container is still being constructed and used. Is there a workaround for this? Can I specify in the options to use the IDesignTimeDbContextFactory ? |
This is related to #27322 |
File a bug
I have a problem with migrations script command failing. It seems it doesn't use the design time factory I have implemented and tries to run the host builder instead (which doesn't have any connection string on the build server).
If I set a (fake) connection string, everything works fine. That makes me thinking the factory is not actually used even though, as the log suggests, it has been noticed by the tools.
Is this a bug or am I doing something wrong?
My factory
It uses the parameterless constructor with no connections string supplied. As it is only used to generate the migrations script, it should all be fine as no db connection is ever needed.
Verbose output
Local paths and project names changed/removed.
Include provider and version information
EF Core version: 5.0.6
Entity Framework Core .NET Command-line Tools 5.0.6
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 5.0
Operating system: Windows 10
IDE: Visual Studio 2019 16.9.4
Pretty sure it is environment independent as I have the same issue on a linux build server.
The text was updated successfully, but these errors were encountered: