using Furion.DatabaseAccessor; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace Admin.NET.Core { /// /// 库区表 /// [Table("wms_area")] [Comment("库区表")] public class WmsArea : DEntityBase, IEntityTypeBuilder { /// /// 名称 /// [Comment("名称")] [Required] [MaxLength(50)] public string AreaName { get; set; } /// /// 描述 /// [Comment("描述")] [MaxLength(250)] public string AreaDesc { get; set; } /// /// 状态;数据字典 /// [Comment("状态")] [Required] public CommonStatus AreaStatus { get; set; } /// /// 分类;数据字典 /// [Comment("分类")] [Required] public AreaType AreaType { get; set; } /// /// 是否为钢平台 /// [Comment("是否为钢平台")] public bool IsSteel { get; set; } /// /// 所属车间 /// [Comment("所属车间")] public LesWorkShopType WorkShopType { get; set; } /// /// 库位表 /// public ICollection WmsPlaces { get; set; } /// /// 库口表 /// public ICollection LesEntrance { get; set; } /// /// 构建一对多的关系 /// /// /// /// public void Configure(EntityTypeBuilder entityBuilder, DbContext dbContext, Type dbContextLocator) { entityBuilder.HasMany(x => x.WmsPlaces) .WithOne(x => x.WmsArea) .HasForeignKey(x => x.AreaId).IsRequired(true); entityBuilder.HasMany(x => x.LesEntrance) .WithOne(x => x.WmsArea) .HasForeignKey(x => x.AreaId).IsRequired(true); } } }