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