Scaffolding wants to use a different database provider to my project
See original GitHub issueAsk a question
I am in the process of building a Asp.Net Core website with Razor pages, however whenever I attempt to use any of the scaffolding options that require a database context, one of two things happen.
Either A, the scaffolding process automatically installs ‘Microsoft.EntityFrameworkCore.SqlServer’ version 5.0.8, and downgrades ‘Microsoft.EntityFrameworkCore.Tools’ to version 5.0.8. Or B, it gives the following error message:
There was an error running the selected code generator:
'To scaffold, install the following Entity Framework core packages and try again:
Microsoft.EntityFrameworkCore.SqlServer.'
I have checked all of the files in my project and have found no mention of MS SQL Server anywhere. In fact the only references I have found to any database providers is in ‘Startup.cs’ and in the list of required packages. For reference, here is the code I use to add the database context under services.
services.AddDbContext<ApplicationDbContext>(options => {
options.UseMySql(Configuration.GetConnectionString("DefaultConnection"),
ServerVersion.AutoDetect(Configuration.GetConnectionString("DefaultConnection")));
options.UseLazyLoadingProxies(false);
}) ;
Is there anywhere else I need to specify the database provider besides ‘ConfigureServices’ in ‘startup.cs’ in order for scaffolding to work, or is there something else I am missing that is causing scaffolding to use the incorrect database provider?
Provider and version information
EF Core version: 5.0.10 Database provider: Pomelo.EntityFrameworkCore.MySql Target framework: NET 5.0 Operating system: Windows 10 IDE: Visual Studio 2019 16.11.2
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
Very well. Thank you for your time.
Where did MS publish that?
See EF O/RM considerations While EF Core is good at abstracting many programming details, there are some …
This is not an EF repo, this is the scaffolding repo. Scaffolding MySQL was never planned.