Thursday, August 19, 2021

 How to generate Model class and DbContext from existing Data Base using .NET Core 

Open the Nuget Manage and run the following command
Scaffold-DbContext Name=DBConnection Microsoft.EntityFrameworkCore.SqlServer -OutputDir Model -Tables KpiSMSLog

Which will only include the table name kpismslog

To specify Name Space

PM> Scaffold-DbContext Name=HostDB Microsoft.EntityFrameworkCore.SqlServer -Namespace ScheduleMonitor -ContextNamespace ScheduleMonitor.Business


Script migration Changes

Script-Migration -From 20200810134651_partyIdentifer_column -To 20201118122724_SAPuserIdColumn 

How to reset the Identity column value using SQL

DBCC CHECKIDENT('Bookings', RESEED, 1)


No comments:

 How to generate Model class and DbContext from existing Data Base using .NET Core  Open the Nuget Manage and run the following command Scaf...