ExamGrade.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using Furion.DatabaseAccessor;
  2. using Microsoft.EntityFrameworkCore;
  3. using Microsoft.EntityFrameworkCore.Metadata.Builders;
  4. using System;
  5. using System.ComponentModel.DataAnnotations;
  6. using System.ComponentModel.DataAnnotations.Schema;
  7. namespace YBEE.EQM.Core;
  8. /// <summary>
  9. /// 监测年级
  10. /// </summary>
  11. [Comment("监测年级")]
  12. public class ExamGrade : DEntityBase, IEntityTypeBuilder<ExamGrade>
  13. {
  14. /// <summary>
  15. /// 监测计划ID
  16. /// </summary>
  17. [Comment("监测计划ID")]
  18. [Required]
  19. public int ExamPlanId { get; set; }
  20. /// <summary>
  21. /// 年级ID
  22. /// </summary>
  23. [Comment("年级ID")]
  24. [Required]
  25. public short GradeId { get; set; }
  26. /// <summary>
  27. /// 年份(级)
  28. /// </summary>
  29. [Comment("年份(级)")]
  30. [Required]
  31. public short GradeBeginYear { get; set; }
  32. /// <summary>
  33. /// 年份(届)
  34. /// </summary>
  35. [Comment("年份(届)")]
  36. [Required]
  37. public short GradeEndYear { get; set; }
  38. /// <summary>
  39. /// 学段
  40. /// </summary>
  41. [Comment("学段")]
  42. [Required, Column(TypeName = "smallint")]
  43. public EducationStage EducationStage { get; set; }
  44. /// <summary>
  45. /// 学制
  46. /// </summary>
  47. [Comment("学制")]
  48. [Required]
  49. public short EducationYears { get; set; }
  50. /// <summary>
  51. /// 一对一引用(年级)
  52. /// </summary>
  53. public virtual Grade Grade { get; set; }
  54. /// <summary>
  55. /// 一对一引用(监测计划)
  56. /// </summary>
  57. public virtual ExamPlan ExamPlan { get; set; }
  58. public void Configure(EntityTypeBuilder<ExamGrade> entityBuilder, DbContext dbContext, Type dbContextLocator)
  59. {
  60. entityBuilder.HasIndex(x => new { x.ExamPlanId, x.GradeId }).IsUnique().HasDatabaseName("idx_exam_grade_exam_plan_id_grade_id");
  61. }
  62. }