1 to 1, 1 to Many and Many to Many Relationships with EFCore in 2023

Описание к видео 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:
   • DbContext, Code First Migrations and ...  

Before Source Code:
https://github.com/hpt-dev/EntityFram...

After Source Code:
https://github.com/hpt-dev/EntityFram...

Database Diagram:
https://ibb.co/RQnqXY1

What is a Navigation Property?
https://blog.staticvoid.co.nz/2012/en...

https://www.c-sharpcorner.com/article...

Microsoft Docs on Entity Framework
https://learn.microsoft.com/en-us/ef/

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):
script-migration -o ./fileName.sql

5. Move database back to a previous migration:
update-database previousMigrationName

Комментарии

Информация по комментариям в разработке