using Furion.DatabaseAccessor; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace YBEE.EQM.Core; /// /// 监测年级 /// [Comment("监测年级")] public class ExamGrade : DEntityBase, IEntityTypeBuilder { /// /// 监测计划ID /// [Comment("监测计划ID")] [Required] public int ExamPlanId { get; set; } /// /// 年级ID /// [Comment("年级ID")] [Required] public short GradeId { get; set; } /// /// 年份(级) /// [Comment("年份(级)")] [Required] public short GradeBeginYear { get; set; } /// /// 年份(届) /// [Comment("年份(届)")] [Required] public short GradeEndYear { get; set; } /// /// 学段 /// [Comment("学段")] [Required, Column(TypeName = "smallint")] public EducationStage EducationStage { get; set; } /// /// 学制 /// [Comment("学制")] [Required] public short EducationYears { get; set; } /// /// 一对一引用(年级) /// public virtual Grade Grade { get; set; } /// /// 一对一引用(监测计划) /// public virtual ExamPlan ExamPlan { get; set; } public void Configure(EntityTypeBuilder entityBuilder, DbContext dbContext, Type dbContextLocator) { entityBuilder.HasIndex(x => new { x.ExamPlanId, x.GradeId }).IsUnique().HasDatabaseName("idx_exam_grade_exam_plan_id_grade_id"); } }