using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Linq;
namespace MVCjichu.Models
{
public class Model1 : DbContext
{
public Model1()
: base("name=Model1")
{
}
public virtual DbSet<stuInfo> StuInfo { get; set; }
public virtual DbSet<Course> Course { get; set; }
public virtual DbSet<Score> Score { get; set; }
}
public class stuInfo
{
public int Id { get; set; }
[Display(Name="姓名")]
public string Name { get; set; }
[Display(Name = "日期")]
public DateTime Birthday { get; set; }
public virtual ICollection<Score> Scores { get; set; } = new HashSet<Score>();
}
public class Course
{
public int Id { get; set; }
public string Name { get; set; }
public virtual ICollection<Score> Score { get; set; } = new HashSet<Score>();
}
public class Score {
public int Id { get; set; }
public int Value { get; set; }
public int stuInfoId { get; set; }
[ForeignKey("stuInfoId")]
public stuInfo stuInfo { get; set; }
public int CourseId { get; set; }
[ForeignKey("CourseId")]
public Course Course { get; set; }
}
}