{"id":20315105,"url":"https://github.com/hpt-dev/entityframeworkrelationships","last_synced_at":"2025-09-13T22:04:52.665Z","repository":{"id":143922378,"uuid":"537786622","full_name":"hpt-dev/EntityFrameworkRelationships","owner":"hpt-dev","description":"Entity Framework - 1 to 1, 1 to Many and Many to Many relationships","archived":false,"fork":false,"pushed_at":"2022-09-17T12:15:27.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-20T06:51:18.682Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hpt-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-17T11:25:01.000Z","updated_at":"2022-09-17T11:25:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"07d1a37b-ba55-46eb-aed5-67a65178de04","html_url":"https://github.com/hpt-dev/EntityFrameworkRelationships","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hpt-dev/EntityFrameworkRelationships","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hpt-dev%2FEntityFrameworkRelationships","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hpt-dev%2FEntityFrameworkRelationships/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hpt-dev%2FEntityFrameworkRelationships/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hpt-dev%2FEntityFrameworkRelationships/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hpt-dev","download_url":"https://codeload.github.com/hpt-dev/EntityFrameworkRelationships/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hpt-dev%2FEntityFrameworkRelationships/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275032822,"owners_count":25393766,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-13T02:00:10.085Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T18:17:54.713Z","updated_at":"2025-09-13T22:04:52.640Z","avatar_url":"https://github.com/hpt-dev.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Entity Framework - 1 to 1, 1 to Many and Many to Many Relationships with .NET 6 in 2022\n\nSource code used in this video: https://www.youtube.com/watch?v=9sXXfq0GDYI\n\nIn 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.\n\n#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 \n\n▬ Contents of this video  ▬▬▬▬▬▬▬▬▬▬\n0:00 - Introduction\n0:24 - About the example project\n0:40 - Creating the Blog entity\n1:26 - 1 to 1 relationships\n3:41 - Add migration, view changes in the database\n4:16 - 1 to Many relationship\n5:16 - Add migration, view changes in the database\n5:30 - Many to Many relationship\n6:20 - Add migration, view changes in the database\n\nStart here if you've never used Entity Framework before:\nhttps://www.youtube.com/watch?v=A4tpHy__LN0\n\nBefore Source Code:\nhttps://github.com/hpt-dev/EntityFrameworkIntroduction\n\nAfter Source Code:\nhttps://github.com/hpt-dev/EntityFrameworkRelationships\n\nDatabase Diagram:\nhttps://ibb.co/RQnqXY1\n\nWhat is a Navigation Property?\nhttps://blog.staticvoid.co.nz/2012/entity_framework-navigation_property_basics_with_code_first/\n\nhttps://www.c-sharpcorner.com/article/navigation-property-with-code-first-navigation-property-in-ef/\n\nMicrosoft Docs on Entity Framework\nhttps://learn.microsoft.com/en-us/ef/\n\nUseful Entity Framework Commands:\n1. Add a Migration\nadd-migration migrationName -verbose\n\n2. Apply migrations to database:\nupdate-database\n\n3. Remove the most recent migration:\nremove-migration\n\n4. Get SQL Script for a Migration (will write file to project folder):\nscript-migration -o ./fileName.sql \n\n5. Move database back to a previous migration:\nupdate-database previousMigrationName\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhpt-dev%2Fentityframeworkrelationships","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhpt-dev%2Fentityframeworkrelationships","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhpt-dev%2Fentityframeworkrelationships/lists"}