Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Foreign key and navigation properties: bullet 2 #33624

Closed
nkn300pm opened this issue Sep 17, 2024 · 3 comments
Closed

Foreign key and navigation properties: bullet 2 #33624

nkn300pm opened this issue Sep 17, 2024 · 3 comments
Assignees
Labels
aspnet-core/svc data-access/subsvc seQUESTered Identifies that an issue has been imported into Quest. Source - Docs.ms Docs Customer feedback via GitHub Issue

Comments

@nkn300pm
Copy link

nkn300pm commented Sep 17, 2024

Description

[Enter feedback here]
section: Foreign key and navigation properties
section link: https://learn.microsoft.com/en-us/aspnet/core/data/ef-rp/complex-data-model?view=aspnetcore-8.0&tabs=visual-studio#foreign-key-and-navigation-properties-1

bullet 2: An administrator is always an instructor. Therefore the InstructorID property is included as the FK to the Instructor entity.

I think it should be: FK to the Department entity

Page URL

https://learn.microsoft.com/en-us/aspnet/core/data/ef-rp/complex-data-model?view=aspnetcore-8.0&tabs=visual-studio

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/data/ef-rp/complex-data-model.md

Document ID

7a77b058-f005-8d68-ae46-e487c597f18e

Article author

@tdykstra


Associated WorkItem - 321202

@tdykstra
Copy link
Contributor

InstructorID property is included as the FK to the Instructor entity.

I think it should be: FK to the Department entity

I don't see the logic in calling InstructorID the FK to the Department entity; wouldn't that be named DepartmentID?

@nkn300pm
Copy link
Author

nkn300pm commented Sep 24, 2024

Above the Section Foreign key and navigation properties is the class definition of Department entity

According to the class definition of the Department which is included below, we can see that InstructorID clearly the FK to the Department entity.

public class Department
{
public int DepartmentID { get; set; }

    [StringLength(50, MinimumLength = 3)]
    public string Name { get; set; }

    [DataType(DataType.Currency)]
    [Column(TypeName = "money")]
    public decimal Budget { get; set; }

    [DataType(DataType.Date)]
    [DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}",
                   ApplyFormatInEditMode = true)]
    [Display(Name = "Start Date")]
    public DateTime StartDate { get; set; }

    public int? InstructorID { get; set; }

    public Instructor Administrator { get; set; }
    public ICollection<Course> Courses { get; set; }
}

Therefore, I believe it is not ok when bullet 2 says that " ... Therefore the InstructorID property is included as the FK to the Instructor entity." As we can see in the Department table, InstructorID is the FK to the Department table

@Rick-Anderson
Copy link
Contributor

Above the Section Foreign key and navigation properties is the class definition of Department entity

According to the class definition of the Department which is included below, we can see that InstructorID clearly the FK to the Department entity.

public class Department { public int DepartmentID { get; set; }

    [StringLength(50, MinimumLength = 3)]
    public string Name { get; set; }

    [DataType(DataType.Currency)]
    [Column(TypeName = "money")]
    public decimal Budget { get; set; }

    [DataType(DataType.Date)]
    [DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}",
                   ApplyFormatInEditMode = true)]
    [Display(Name = "Start Date")]
    public DateTime StartDate { get; set; }

    public int? InstructorID { get; set; }

    public Instructor Administrator { get; set; }
    public ICollection<Course> Courses { get; set; }
}

Therefore, I believe it is not ok when bullet 2 says that " ... Therefore the InstructorID property is included as the FK to the Instructor entity." As we can see in the Department table, InstructorID is the FK to the Department table

That's not correct.

@dotnet dotnet locked as resolved and limited conversation to collaborators Sep 25, 2024
@tdykstra tdykstra added reQUEST Triggers an issue to be imported into Quest and removed ⌚ Not Triaged labels Oct 5, 2024
@sequestor sequestor bot added seQUESTered Identifies that an issue has been imported into Quest. and removed reQUEST Triggers an issue to be imported into Quest labels Oct 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
aspnet-core/svc data-access/subsvc seQUESTered Identifies that an issue has been imported into Quest. Source - Docs.ms Docs Customer feedback via GitHub Issue
Projects
Development

No branches or pull requests

4 participants