ExamOrg.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using Furion.DatabaseAccessor;
  2. using Microsoft.EntityFrameworkCore;
  3. using Microsoft.EntityFrameworkCore.Metadata.Builders;
  4. using System;
  5. using System.ComponentModel.DataAnnotations;
  6. namespace YBEE.EQM.Core;
  7. /// <summary>
  8. /// 监测机构
  9. /// </summary>
  10. [Comment("监测机构")]
  11. public class ExamOrg : DEntityBase, IEntityTypeBuilder<ExamOrg>
  12. {
  13. /// <summary>
  14. /// 监测计划ID
  15. /// </summary>
  16. [Comment("监测计划ID")]
  17. [Required]
  18. public int ExamPlanId { get; set; }
  19. /// <summary>
  20. /// 监测机构ID
  21. /// </summary>
  22. [Comment("监测机构ID")]
  23. [Required]
  24. public short SysOrgId { get; set; }
  25. /// <summary>
  26. /// 一对一引用(机构)
  27. /// </summary>
  28. public virtual SysOrg SysOrg { get; set; }
  29. /// <summary>
  30. /// 一对一引用(监测计划)
  31. /// </summary>
  32. public virtual ExamPlan ExamPlan { get; set; }
  33. public void Configure(EntityTypeBuilder<ExamOrg> entityBuilder, DbContext dbContext, Type dbContextLocator)
  34. {
  35. entityBuilder.HasIndex(x => new { x.ExamPlanId, x.SysOrgId }).IsUnique().HasDatabaseName("idx_exam_org_exam_plan_id_sys_org_id");
  36. }
  37. }