Code-First migration.
Create Employee.cs class under Database.core, into Domain folder with given code.


Create DatabaseTaskDbContext.cs under DatabaseTask.Data.

and put there the following code

Go appsettings.json file and change DefaultConnection string to your own server name.

open nuget packet manager console and write add-migration <migratsiooni nimi>

then update-database

Code-First migration is completed

Database-First migration





‘
install

Scaffold-DbContext “Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=SkibidiToilet;Integrated Security=True;Encrypt=True” Microsoft.EntityFrameWorkCore.SqlServer -outputdir Repository/Models -context UserDbContext -contextdir Repository -DataAnnotations -Force




