Home > OS >  How to connect to MySQL server using Entity Framework Core
How to connect to MySQL server using Entity Framework Core

Time:05-07

I am using Visual Studio 2019 community edition. I want to connect to MySQL using Entity Framework core. I do not want to use Entity Framework 6.

I am running into following issues:

  1. I created a new project using "ASP .NET CORE App and ASP .NET CORE Web App" template and it does not show option to add Entity Framework.

enter image description here

  1. If I use tools > Connect to Database option from menu, I do not see option to connect to MySQL. How can I enable this option.

enter image description here

CodePudding user response:

Install "Pomelo.EntityFrameworkCore.MySql" using the NuGet Package Manager in Visual Studio 2019.

Then follow the instructions to configure it in your project: https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/#getting-started

CodePudding user response:

EFCore is a package, not a file you would add to your project. Go to Project>NuGet Package Manager and install Microsoft.EntityFrameworkCore, Microsoft.EntityFrameworkCore.Tools. Then you can scaffold the connection to your database by running the scaffold-dbcontext command in the PM console.

  • Related