filmov
tv
1 to 1, 1 to Many and Many to Many Relationships with EFCore in 2023
Показать описание
In this video we'll use entity framework to set up 1 to 1, 1 to Many, and Many to Many relationships using a code first approach. The example project is an API for a blogging platform.
#dotnet #dotnetprogramming #dotnet6 #programming #csharp #programmingforbeginners #csharp #csharptutorial #csharpdotnet #aspnetcore #programmingtutorials #entityframework #entityframeworkcore #sqlserver #sql #sqlite #sqlforbeginners #database #sqldatabase #sqlservertutorial #codefirst #1to1 #onetoone #1tomany #onetomany #manytomany #codefirst
▬ Contents of this video ▬▬▬▬▬▬▬▬▬▬
0:00 - Introduction
0:24 - About the example project
0:40 - Creating the Blog entity
1:26 - 1 to 1 relationships
3:41 - Add migration, view changes in the database
4:16 - 1 to Many relationship
5:16 - Add migration, view changes in the database
5:30 - Many to Many relationship
6:20 - Add migration, view changes in the database
Start here if you've never used Entity Framework before:
Before Source Code:
After Source Code:
Database Diagram:
What is a Navigation Property?
Microsoft Docs on Entity Framework
Useful Entity Framework Commands:
1. Add a Migration
add-migration migrationName -verbose
2. Apply migrations to database:
update-database
3. Remove the most recent migration:
remove-migration
4. Get SQL Script for a Migration (will write file to project folder):
5. Move database back to a previous migration:
update-database previousMigrationName
#dotnet #dotnetprogramming #dotnet6 #programming #csharp #programmingforbeginners #csharp #csharptutorial #csharpdotnet #aspnetcore #programmingtutorials #entityframework #entityframeworkcore #sqlserver #sql #sqlite #sqlforbeginners #database #sqldatabase #sqlservertutorial #codefirst #1to1 #onetoone #1tomany #onetomany #manytomany #codefirst
▬ Contents of this video ▬▬▬▬▬▬▬▬▬▬
0:00 - Introduction
0:24 - About the example project
0:40 - Creating the Blog entity
1:26 - 1 to 1 relationships
3:41 - Add migration, view changes in the database
4:16 - 1 to Many relationship
5:16 - Add migration, view changes in the database
5:30 - Many to Many relationship
6:20 - Add migration, view changes in the database
Start here if you've never used Entity Framework before:
Before Source Code:
After Source Code:
Database Diagram:
What is a Navigation Property?
Microsoft Docs on Entity Framework
Useful Entity Framework Commands:
1. Add a Migration
add-migration migrationName -verbose
2. Apply migrations to database:
update-database
3. Remove the most recent migration:
remove-migration
4. Get SQL Script for a Migration (will write file to project folder):
5. Move database back to a previous migration:
update-database previousMigrationName
Комментарии