MySQL Entity Framework 6: Database First. How to create classes?

  1. Need to install some NuGet on your NuGet administrator
    microsoft.EntityFrameworkCore
    microsoftEntityFrameworkCore.Tools
    Microsoft.NETCore.App
    Pomelo.EntityFrameworkCore.MySQL
    
  2. After having all your NuGet, you need to apply this to your Package Console Administrator:
    Scaffold-DbContext 
    "Server=localhost;Database=database_name;User=root;Password=123456;" 
    "Pomelo.EntityFrameworkCore.MySql" -Outputdir Models
    

This will create a context for all your models and will also create some models for your data base.

Leave a Comment