🌝

Use EF In DotNet Core

Posted at — Dec 22, 2020
#csharp

How to create ef in .net core.

How to create entity in dotnet core

Install Packages

First of all, you need install the packages that needed to create the entitys through the nuget package manager.

Create Entity

Then you can create entitys with the following command at the console.

For Mysql:

1
Scaffold-DbContext -Provider Pomelo.EntityFrameworkCore.MySql -Context DBContext -Project Common -Connection "Server={xxx.xxx.xxx.xxx};User Id={uid};Password={pw};Database={dbname}" -outputdir {foldername}

For Sql:

1
Scaffold-DbContext -Force “Server={xxx.xxx.xxx.xxx};Database={dbname};User ID={uid};Password={pw};” Microsoft.EntityFrameworkCore.SqlServer -OutputDir {foldername}