コード例 #1
0
 public ProductsApplicationAutoMapperProfile(IAttributeOptionIdsSerializer attributeOptionIdsSerializer)
 {
     /* You can configure your AutoMapper mapping configuration here.
      * Alternatively, you can split your mapping configurations
      * into multiple profile classes for a better organization. */
     CreateMap <Product, ProductDto>()
     .Ignore(dto => dto.ProductGroupDisplayName)
     .Ignore(dto => dto.Sold)
     .Ignore(dto => dto.MinimumPrice)
     .Ignore(dto => dto.MaximumPrice);
     CreateMap <ProductDetail, ProductDetailDto>();
     CreateMap <ProductAttribute, ProductAttributeDto>();
     CreateMap <ProductAttributeOption, ProductAttributeOptionDto>();
     CreateMap <ProductSku, ProductSkuDto>()
     .ForSourceMember(entity => entity.SerializedAttributeOptionIds, opt => opt.DoNotValidate())
     .Ignore(dto => dto.AttributeOptionIds)
     .Ignore(dto => dto.Price)
     .Ignore(dto => dto.DiscountedPrice)
     .Ignore(dto => dto.Inventory)
     .Ignore(dto => dto.Sold)
     .AfterMap(async(src, dest) => dest.AttributeOptionIds =
                   (await attributeOptionIdsSerializer.DeserializeAsync(src.SerializedAttributeOptionIds)).ToList());
     CreateMap <CreateUpdateProductDetailDto, ProductDetail>(MemberList.Source)
     .ForSourceMember(dto => dto.StoreId, opt => opt.DoNotValidate());
     CreateMap <CreateUpdateProductAttributeDto, ProductAttribute>(MemberList.Source);
     CreateMap <CreateUpdateProductAttributeOptionDto, ProductAttributeOption>(MemberList.Source);
     CreateMap <Category, CategoryDto>();
     CreateMap <Category, CategorySummaryDto>();
     CreateMap <ProductCategory, ProductCategoryDto>();
     CreateMap <ProductHistory, ProductHistoryDto>();
     CreateMap <ProductDetailHistory, ProductDetailHistoryDto>();
     CreateMap <ProductView, ProductViewDto>();
     CreateMap <Product, ProductView>(MemberList.Destination);
 }
コード例 #2
0
ファイル: ProductManager.cs プロジェクト: yuxueliang/EShop
 public ProductManager(
     IProductRepository productRepository,
     IProductStoreRepository productStoreRepository,
     IProductCategoryRepository productCategoryRepository,
     IAttributeOptionIdsSerializer attributeOptionIdsSerializer)
 {
     _productRepository            = productRepository;
     _productStoreRepository       = productStoreRepository;
     _productCategoryRepository    = productCategoryRepository;
     _attributeOptionIdsSerializer = attributeOptionIdsSerializer;
 }
コード例 #3
0
 public ProductsTestDataBuilder(
     IProductManager productManager,
     IUnitOfWorkManager unitOfWorkManager,
     IProductDetailRepository productDetailRepository,
     IAttributeOptionIdsSerializer attributeOptionIdsSerializer)
 {
     _productManager               = productManager;
     _unitOfWorkManager            = unitOfWorkManager;
     _productDetailRepository      = productDetailRepository;
     _attributeOptionIdsSerializer = attributeOptionIdsSerializer;
 }
コード例 #4
0
 public ProductAppService(
     IProductManager productManager,
     IOptions <EShopProductsOptions> options,
     IProductInventoryProvider productInventoryProvider,
     IAttributeOptionIdsSerializer attributeOptionIdsSerializer,
     IProductStoreRepository productStoreRepository,
     IProductRepository repository) : base(repository)
 {
     _productManager               = productManager;
     _options                      = options.Value;
     _productInventoryProvider     = productInventoryProvider;
     _attributeOptionIdsSerializer = attributeOptionIdsSerializer;
     _productStoreRepository       = productStoreRepository;
     _repository                   = repository;
 }
コード例 #5
0
 public ProductAppService(
     IProductManager productManager,
     IProductInventoryProvider productInventoryProvider,
     IAttributeOptionIdsSerializer attributeOptionIdsSerializer,
     IProductStoreRepository productStoreRepository,
     IProductTypeRepository productTypeRepository,
     IProductRepository repository) : base(repository)
 {
     _productManager               = productManager;
     _productInventoryProvider     = productInventoryProvider;
     _attributeOptionIdsSerializer = attributeOptionIdsSerializer;
     _productStoreRepository       = productStoreRepository;
     _productTypeRepository        = productTypeRepository;
     _repository = repository;
 }
コード例 #6
0
 public ProductManager(
     IProductRepository productRepository,
     IProductPriceProvider productPriceProvider,
     IProductDetailRepository productDetailRepository,
     IProductCategoryRepository productCategoryRepository,
     IProductInventoryProviderResolver productInventoryProviderResolver,
     IAttributeOptionIdsSerializer attributeOptionIdsSerializer,
     IProductGroupConfigurationProvider productGroupConfigurationProvider)
 {
     _productRepository                 = productRepository;
     _productPriceProvider              = productPriceProvider;
     _productDetailRepository           = productDetailRepository;
     _productCategoryRepository         = productCategoryRepository;
     _productInventoryProviderResolver  = productInventoryProviderResolver;
     _attributeOptionIdsSerializer      = attributeOptionIdsSerializer;
     _productGroupConfigurationProvider = productGroupConfigurationProvider;
 }
コード例 #7
0
 public ProductAppService(
     IProductManager productManager,
     IOptions <EShopProductsOptions> options,
     IDistributedCache <ProductViewCacheItem> cache,
     IProductInventoryProvider productInventoryProvider,
     IProductViewCacheKeyProvider productViewCacheKeyProvider,
     IAttributeOptionIdsSerializer attributeOptionIdsSerializer,
     IProductRepository repository) : base(repository)
 {
     _productManager               = productManager;
     _cache                        = cache;
     _options                      = options.Value;
     _productInventoryProvider     = productInventoryProvider;
     _productViewCacheKeyProvider  = productViewCacheKeyProvider;
     _attributeOptionIdsSerializer = attributeOptionIdsSerializer;
     _repository                   = repository;
 }
コード例 #8
0
 public SampleDataSeedContributor(
     IGuidGenerator guidGenerator,
     ICurrentTenant currentTenant,
     IStoreRepository storeRepository,
     IProductManager productManager,
     IProductRepository productRepository,
     ICategoryManager categoryManager,
     ICategoryRepository categoryRepository,
     IProductCategoryRepository productCategoryRepository,
     ISettingProvider settingProvider,
     IAttributeOptionIdsSerializer attributeOptionIdsSerializer)
 {
     _guidGenerator                = guidGenerator;
     _currentTenant                = currentTenant;
     _storeRepository              = storeRepository;
     _productManager               = productManager;
     _productRepository            = productRepository;
     _categoryManager              = categoryManager;
     _categoryRepository           = categoryRepository;
     _productCategoryRepository    = productCategoryRepository;
     _settingProvider              = settingProvider;
     _attributeOptionIdsSerializer = attributeOptionIdsSerializer;
 }
コード例 #9
0
 public ProductDomainTests()
 {
     ProductRepository            = ServiceProvider.GetRequiredService <IProductRepository>();
     ProductManager               = ServiceProvider.GetRequiredService <IProductManager>();
     AttributeOptionIdsSerializer = ServiceProvider.GetRequiredService <IAttributeOptionIdsSerializer>();
 }