对比新文件 |
| | |
| | | using Volo.Abp.Data; |
| | | using Volo.Abp.DependencyInjection; |
| | | using Volo.Abp.Guids; |
| | | using Volo.Abp.Uow; |
| | | |
| | | namespace CMS.Plugin.HIAWms.Domain.WmsContainers |
| | | { |
| | | /// <summary> |
| | | /// WmsContainer绉嶅瓙鏁版嵁鎻愪緵绋嬪簭 |
| | | /// </summary> |
| | | public class WmsContainerDataSeedContributor : IDataSeedContributor, ITransientDependency |
| | | { |
| | | private readonly IUnitOfWorkManager _unitOfWorkManager; |
| | | private readonly IWmsContainerRepository _wmscontainerRepository; |
| | | private readonly IGuidGenerator _guidGenerator; |
| | | |
| | | /// <summary> |
| | | /// Initializes a new instance of the <see cref="WmsContainerDataSeedContributor"/> class. |
| | | /// </summary> |
| | | /// <param name="unitOfWorkManager">The unit of work manager.</param> |
| | | /// <param name="guidGenerator">The unique identifier generator.</param> |
| | | /// <param name="wmscontainerRepository">The work section repository.</param> |
| | | public WmsContainerDataSeedContributor(IUnitOfWorkManager unitOfWorkManager, IGuidGenerator guidGenerator, IWmsContainerRepository wmscontainerRepository) |
| | | { |
| | | _unitOfWorkManager = unitOfWorkManager; |
| | | _wmscontainerRepository = wmscontainerRepository; |
| | | _guidGenerator = guidGenerator; |
| | | } |
| | | |
| | | /// <inheritdoc /> |
| | | public async Task SeedAsync(DataSeedContext context) |
| | | { |
| | | if (context.Properties.ContainsKey(CMSPluginDbProperties.ConnectionStringName) && context.Properties[CMSPluginDbProperties.ConnectionStringName]?.ToString() == CMSPluginDbProperties.ConnectionStringName) |
| | | { |
| | | try |
| | | { |
| | | //using var unitofWork = _unitOfWorkManager.Begin(requiresNew: true); |
| | | //await unitofWork.SaveChangesAsync(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Console.WriteLine(ex.Message); |
| | | } |
| | | } |
| | | |
| | | if (context.Properties.ContainsKey("SeedTestData") && context.Properties["SeedTestData"]?.ToString() == "SeedTestData") |
| | | { |
| | | try |
| | | { |
| | | await SeedWmsContainerDataAsync(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | Console.WriteLine(e.Message); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Seeds the work section data asynchronous. |
| | | /// </summary> |
| | | private async Task SeedWmsContainerDataAsync() |
| | | { |
| | | |
| | | } |
| | | } |
| | | } |