I have done two test projects, one with MySQL.EntityFramworkCore and another with Pomelo.EntityFrameworkCore and in both of them the same thing happened to me when obtaining the model from the database.
1.- Scaffold-DbContext 'server = x.x.x.x.x; user = xxxx; password = xxxx; database = name;' MySql.EntityFrameworkCore -OutputDir Models -f
2.- Scaffold-DbContext 'server = x.x.x.x.x; user = xxxx; password = xxxx; database = name;' Pomelo.EntityFrameworkCore.MySql -OutputDir Models -f
I have tables like the following in my database: brand_cars and when performing the dbFirst process. It changes my name to BrandCars.
In SQLServer exist the parameter -UseDatabaseNames, but in mysql I have not found it
In the connector options I have not found this option. https://mysqlconnector.net/connection-options/
Is there a possibility to force that you do not change the name of the database table when performing dbFirst?
The versions of my connectors are as follows:
-For the Pomelo project
Microsoft.EntityFrameworkCore.Tools 3.1.12
Pomelo.EntityFrameworkCore.MySql 3.2.4
Pomelo.EntityFrameworkCore.MySql.Design 1.1.2
-For the MySQL project
Microsoft.EntityFrameworkCore.Design 5.0.3
Microsoft.EntityFrameworkCore.Tools 5.0.3
MySql.EntityFrameworkCore 5.0.0
Works fine for me using Pomelo.EntityFrameworkCore.MySql in its
5.0.0-alpha.2(or nightly build) release.I tested it using the following SQL:
I then executed the following command, using the
--use-database-namesparameter:The result is the following class:
It should be mentioned that if you don't want EF Core to change the database table names in any way, you should also add the
--no-pluralizeflag in addition to--use-database-names.