One too many Relationships In the .net core a class have many students in my cause I could not get the student's class name from students table

public class Student
{
[Key]
public int Id { get; set; }
[Required]
[StringLength(100)]
public string FirstName { get; set; }
[Required]
[StringLength(100)]
public string LastName { get; set; }
[Required]
[StringLength(200)]
public string ContactPerson { get; set; }
[Required]
public string ContactNo { get; set; }
[Required]
[EmailAddress]
public string Email { get; set; }
[Required]
public string DateOfBirth { get; set; }
//Navigations Properties
[Required]
public int? ClassId { get; set; }
public Class Class { get; set; }
}
public class Class
{
[Key]
public int Id { get; set; }
[Required]
[StringLength(100)]
public string Name { get; set; }
public ICollection
}




Sachin SinghRank #66 · 26.2K reputationPosted Aug 10, 2022, 12:25 PM EDT
Vishal YelveRank #178 · 13.6K reputationPosted Aug 10, 2022, 11:44 AM EDT
Naresh BeniwalRank #365 · 6.8K reputationPosted Nov 12, 2022, 2:49 PM EST
https://www.entityframeworktutorial.net/efcore/one-to-many-conventions-entity-framework-core.aspx