using Furion.DatabaseAccessor;
|
using iWare.Wms.Core.Enum;
|
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
namespace iWare.Wms.Core
|
{
|
/// <summary>
|
/// 库区
|
/// </summary>
|
[Table("wms_area")]
|
[Comment("库区")]
|
public class WmsArea:DEntityBase,IEntityTypeBuilder<WmsArea>
|
{
|
/// <summary>
|
/// 名称
|
/// </summary>
|
[Comment("名称")]
|
[Required]
|
[MaxLength(50)]
|
public string AreaName { get; set; }
|
|
/// <summary>
|
/// 描述
|
/// </summary>
|
[Comment("描述")]
|
[MaxLength(250)]
|
public string AreaDesc { get; set; }
|
|
/// <summary>
|
/// 状态;数据字典
|
/// </summary>
|
[Comment("状态")]
|
[Required]
|
public CommonStatus AreaStatus { get; set; }
|
|
/// <summary>
|
/// 分类;数据字典
|
/// </summary>
|
[Comment("分类")]
|
[Required]
|
public AreaType AreaType { get; set; }
|
|
|
public ICollection<WmsPlace> WmsPlaces { get; set; }
|
/// <summary>
|
/// 构建一对多的关系
|
/// </summary>
|
/// <param name="entityBuilder"></param>
|
/// <param name="dbContext"></param>
|
/// <param name="dbContextLocator"></param>
|
public void Configure(EntityTypeBuilder<WmsArea> entityBuilder, DbContext dbContext, Type dbContextLocator)
|
{
|
entityBuilder.HasMany(x => x.WmsPlaces)
|
.WithOne(x => x.WmsArea)
|
.HasForeignKey(x => x.AreaId).IsRequired(true);
|
}
|
}
|
}
|