Dotnet-Core-Scaffolding-MSSQL

MS SQL Database Scaffolding with Entity Framework Core

APACHE-2.0 License

Stars
5

Scaffolding MS SQL Database in Dotnet Core

About This

This is a project for Scaffolding DBContext in Entity Framework Core from existing MS SQL database.

NuGet Packages

NuGet Packages Version
Microsoft.EntityFrameworkCore 5.0.2
Microsoft.EntityFrameworkCore.SqlServer 5.0.2
Microsoft.EntityFrameworkCore.Tools 5.0.2

Dependencies

How to use it?

It's very simple. It's a C# class library targeting .net core 3.1. So makesure you have .net core 3.1 selected as target framework.

Step # 1 :

Clone the repository

Step # 2 :

Select Windows Authentication from SSMS (SQL Server Management Studio)

Step # 3 :

Open the solution file with Visual Studio 2019

Step # 4 :

Go to ***Tools > NuGet package manger > Package Manager Console***

Step # 5 :

Run the following Command

Scaffold-DbContext "User Id=[Your User Id];Database=[Database Name];TrustServerCertificate=True;Encrypt=False;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Entities

N.B: In case yout are not using windows authentication, use the following command

Scaffold-DbContext "User Id=[Your User Id];Password=[Your Password];Database=[Database Name];TrustServerCertificate=True;Encrypt=False;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Entities

License

MIT

Free Software, Hell Yeah!

Tools I used to create this read me. Might also help you!