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 SinghPosted Aug 10, 2022, 4:25 PM
Naresh BeniwalPosted Nov 12, 2022, 7:49 PM
https://www.entityframeworktutorial.net/efcore/one-to-many-conventions-entity-framework-core.aspx
Vishal YelvePosted Aug 10, 2022, 3:44 PM