Answers for "data annotation foreign key"

C#
1

data annotation foreign key

using System.ComponentModel.DataAnnotations.Schema;

public class Student
{
    public int StudentID { get; set; }
    public string StudentName { get; set; }
        
    [ForeignKey("Standard")]
    public int StandardRefId { get; set; }
    public Standard Standard { get; set; }
}

public class Standard
{
    public int StandardId { get; set; }
    public string StandardName { get; set; }
    
    public ICollection<Student> Students { get; set; }
}
Posted by: Guest on December-30-2020

Code answers related to "data annotation foreign key"

C# Answers by Framework

Browse Popular Code Answers by Language