using CMS.Plugin.HIAWms.Domain; using CMS.Plugin.HIAWms.Domain.WmsContainers; using CMS.Plugin.HIAWms.Domain.Shared.WmsContainers; using Microsoft.EntityFrameworkCore; using Volo.Abp; using Volo.Abp.EntityFrameworkCore.Modeling; namespace CMS.Plugin.HIAWms.EntityFrameworkCore.Extensions; /// /// EfCore扩展 /// public static partial class CMSPluginEfCoreExtensions { /// /// Includes the details. /// /// The queryable. /// if set to true [include]. /// public static IQueryable IncludeDetails(this IQueryable queryable, bool include = true) { if (!include) { return queryable; } return queryable; } /// /// Configures the wmscontainer. /// /// The builder. public static void ConfigureWmsContainer(this ModelBuilder builder) { Check.NotNull(builder, nameof(builder)); builder.Entity(b => { //Configure table & schema name b.ToTable((CMSPluginDbProperties.DbTablePrefix + "_WmsContainers").ToLower(), CMSPluginDbProperties.DbSchema).HasComment("WmsContainer"); b.ConfigureByConvention(); //Properties b.Property(x => x.Code).HasMaxLength(WmsContainerConsts.MaxCodeLength).IsRequired().HasComment("编码"); b.Property(x => x.Name).HasMaxLength(WmsContainerConsts.MaxNameLength).IsRequired().HasComment("名称"); b.Property(x => x.Sort).HasComment("排序"); b.Property(x => x.IsDisabled).IsRequired(false).HasComment("是否禁用"); b.Property(x => x.Remark).HasMaxLength(WmsContainerConsts.MaxRemarkLength).IsRequired(false).HasComment("备注"); b.HasIndex(u => u.Name); b.ApplyObjectExtensionMappings(); }); } }