DB First Code Step by Step by - Tejas Koshti
DB First Code Step by Step by - Tejas Koshti
__________________________________________________________________________
1.Add Extension:
Microsoft.EntityFrameworkCore
Microsoft.EntityFrameworkCore.SqlServer
Microsoft.EntityFrameworkCore.Tools
__________________________________________________________________________
2.Make DB
1. Dept (Parent)
2. Employee (Child)
__________________________________________________________________________
3. NugGet Console
4. Update: Program.cs
options.UseSqlServer(builder.Configuration.GetConnectionString("Yash1Conte
xt")));
__________________________________________________________________________
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"ConnectionStrings": {
"ActsJan25Context": "Data Source=(localdb)\\MsSqlLocalDb;Initial
Catalog=ActsJan25;Integrated Security=true;MultipleActiveResultSets=true"
},
"AllowedHosts": "*"
}
__________________________________________________________________________
Eg 1. Dept (Parent)
2. Employee (Child)
__________________________________________________________________________
😀
7. After All Successful Code
Run The and Enjoy :
__________________________________________________________________________
__________________________________________________________________________