I have a MySQL database sitting in Amazon Cloud (RDS). It is a tiny database with only one table.
I want to use EF Core, Database First. I know that the Pomelo.EntityFrameworkCore.MySql
package is popular, but I cannot see any information on how to achieve a scaffolding of the Db Context via that package.
I followed the instructions here whilst replacing MySql.Data.EntityFrameworkCore.Design
with Pomelo.EntityFrameworkCore.MySql
but when I ran the command below in Package Manager Console:
Scaffold-DbContext "Server=my-db.rds.amazonaws.com;database=TestDb;uid=blah;pwd=blah;" Pomelo.EntityFrameworkCore.MySql -OutputDir Models -f
I just got the error:
The specified framework version '2.0' could not be parsed
What am I missing? Here's how my dummy solution looks
You need to have these references in your .csproj
. Of course, the versions might vary.
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.1.0-preview2-final" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.0.1" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql.Design" Version="1.1.2" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.1.0-preview1-final" />
</ItemGroup>
Note: I had to manually add DotNetCliToolReference
to Microsoft.EntityFrameworkCore.Tools.DotNet
(not via Manage Nuget Packages
view in the Visual Studio
)