12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- using Furion.DatabaseAccessor;
- using Microsoft.EntityFrameworkCore;
- using Microsoft.EntityFrameworkCore.Metadata.Builders;
- using System;
- using System.ComponentModel.DataAnnotations;
- namespace YBEE.EQM.Core;
- /// <summary>
- /// 监测机构
- /// </summary>
- [Comment("监测机构")]
- public class ExamOrg : DEntityBase, IEntityTypeBuilder<ExamOrg>
- {
- /// <summary>
- /// 监测计划ID
- /// </summary>
- [Comment("监测计划ID")]
- [Required]
- public int ExamPlanId { get; set; }
- /// <summary>
- /// 监测机构ID
- /// </summary>
- [Comment("监测机构ID")]
- [Required]
- public short SysOrgId { get; set; }
- /// <summary>
- /// 是否参与监测
- /// </summary>
- [Comment("是否参与监测")]
- [Required]
- public bool IsRequiredExam { get; set; } = true;
- /// <summary>
- /// 一对一引用(机构)
- /// </summary>
- public virtual SysOrg SysOrg { get; set; }
- /// <summary>
- /// 一对一引用(监测计划)
- /// </summary>
- public virtual ExamPlan ExamPlan { get; set; }
- public void Configure(EntityTypeBuilder<ExamOrg> entityBuilder, DbContext dbContext, Type dbContextLocator)
- {
- entityBuilder.HasIndex(x => new { x.ExamPlanId, x.SysOrgId }).IsUnique().HasDatabaseName("idx_exam_org_exam_plan_id_sys_org_id");
- }
- }
|