mirror of https://github.com/EasyAbp/EShop.git
Browse Source
* Migrate object mapping from AutoMapper to Mapperly Migrates the object-to-object mapping of every EShop module, plugin, the integration package and the sample from AutoMapper to Mapperly, following the ABP AutoMapper to Mapperly migration guide. - Replace Volo.Abp.AutoMapper with Volo.Abp.Mapperly (and add a direct Riok.Mapperly reference to every project that defines a mapper). - Swap AbpAutoMapperModule -> AbpMapperlyModule and AddAutoMapperObjectMapper -> AddMapperlyObjectMapper; drop the AbpAutoMapperOptions configuration and the AutoMapper profile classes. - Convert entity -> DTO/ETO and DTO <-> view-model Profile mappings into Mapperly MapperBase<,> mappers. - Build/update aggregates with protected setters explicitly (MapToEntityAsync overrides, domain Update methods, manual construction in the payment/refund synchronizers) instead of relying on reflection-based mapping. - Set ObjectMapperContext on the application services that relied on the global AutoMapper configuration. - Add application-layer tests covering representative entity -> DTO maps. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * Fix sample proj's abp version --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>dev
committed by
GitHub
148 changed files with 1977 additions and 1038 deletions
@ -1,14 +0,0 @@ |
|||
using AutoMapper; |
|||
|
|||
namespace EasyAbp.EShop |
|||
{ |
|||
public class EShopApplicationAutoMapperProfile : Profile |
|||
{ |
|||
public EShopApplicationAutoMapperProfile() |
|||
{ |
|||
/* You can configure your AutoMapper mapping configuration here. |
|||
* Alternatively, you can split your mapping configurations |
|||
* into multiple profile classes for a better organization. */ |
|||
} |
|||
} |
|||
} |
|||
@ -1,14 +0,0 @@ |
|||
using AutoMapper; |
|||
|
|||
namespace EasyAbp.EShop.Web |
|||
{ |
|||
public class EShopWebAutoMapperProfile : Profile |
|||
{ |
|||
public EShopWebAutoMapperProfile() |
|||
{ |
|||
/* You can configure your AutoMapper mapping configuration here. |
|||
* Alternatively, you can split your mapping configurations |
|||
* into multiple profile classes for a better organization. */ |
|||
} |
|||
} |
|||
} |
|||
@ -1,21 +0,0 @@ |
|||
using EasyAbp.EShop.Orders.Orders; |
|||
using EasyAbp.EShop.Orders.Orders.Dtos; |
|||
using AutoMapper; |
|||
using Volo.Abp.ObjectExtending; |
|||
|
|||
namespace EasyAbp.EShop.Orders |
|||
{ |
|||
public class OrdersApplicationAutoMapperProfile : Profile |
|||
{ |
|||
public OrdersApplicationAutoMapperProfile() |
|||
{ |
|||
/* You can configure your AutoMapper mapping configuration here. |
|||
* Alternatively, you can split your mapping configurations |
|||
* into multiple profile classes for a better organization. */ |
|||
CreateMap<Order, OrderDto>(); |
|||
CreateMap<OrderLine, OrderLineDto>(); |
|||
CreateMap<OrderDiscount, OrderDiscountDto>(); |
|||
CreateMap<OrderExtraFee, OrderExtraFeeDto>(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,39 @@ |
|||
using EasyAbp.EShop.Orders.Orders; |
|||
using EasyAbp.EShop.Orders.Orders.Dtos; |
|||
using Riok.Mapperly.Abstractions; |
|||
using Volo.Abp.Mapperly; |
|||
|
|||
namespace EasyAbp.EShop.Orders |
|||
{ |
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class OrderToOrderDtoMapper : MapperBase<Order, OrderDto> |
|||
{ |
|||
public override partial OrderDto Map(Order source); |
|||
|
|||
public override partial void Map(Order source, OrderDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class OrderLineToOrderLineDtoMapper : MapperBase<OrderLine, OrderLineDto> |
|||
{ |
|||
public override partial OrderLineDto Map(OrderLine source); |
|||
|
|||
public override partial void Map(OrderLine source, OrderLineDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class OrderDiscountToOrderDiscountDtoMapper : MapperBase<OrderDiscount, OrderDiscountDto> |
|||
{ |
|||
public override partial OrderDiscountDto Map(OrderDiscount source); |
|||
|
|||
public override partial void Map(OrderDiscount source, OrderDiscountDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class OrderExtraFeeToOrderExtraFeeDtoMapper : MapperBase<OrderExtraFee, OrderExtraFeeDto> |
|||
{ |
|||
public override partial OrderExtraFeeDto Map(OrderExtraFee source); |
|||
|
|||
public override partial void Map(OrderExtraFee source, OrderExtraFeeDto destination); |
|||
} |
|||
} |
|||
@ -1,19 +0,0 @@ |
|||
using EasyAbp.EShop.Orders.Orders; |
|||
using AutoMapper; |
|||
|
|||
namespace EasyAbp.EShop.Orders |
|||
{ |
|||
public class OrdersDomainAutoMapperProfile : Profile |
|||
{ |
|||
public OrdersDomainAutoMapperProfile() |
|||
{ |
|||
/* You can configure your AutoMapper mapping configuration here. |
|||
* Alternatively, you can split your mapping configurations |
|||
* into multiple profile classes for a better organization. */ |
|||
CreateMap<Order, OrderEto>(); |
|||
CreateMap<OrderLine, OrderLineEto>(); |
|||
CreateMap<OrderDiscount, OrderDiscountEto>(); |
|||
CreateMap<OrderExtraFee, OrderExtraFeeEto>(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,38 @@ |
|||
using EasyAbp.EShop.Orders.Orders; |
|||
using Riok.Mapperly.Abstractions; |
|||
using Volo.Abp.Mapperly; |
|||
|
|||
namespace EasyAbp.EShop.Orders |
|||
{ |
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class OrderToOrderEtoMapper : MapperBase<Order, OrderEto> |
|||
{ |
|||
public override partial OrderEto Map(Order source); |
|||
|
|||
public override partial void Map(Order source, OrderEto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class OrderLineToOrderLineEtoMapper : MapperBase<OrderLine, OrderLineEto> |
|||
{ |
|||
public override partial OrderLineEto Map(OrderLine source); |
|||
|
|||
public override partial void Map(OrderLine source, OrderLineEto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class OrderDiscountToOrderDiscountEtoMapper : MapperBase<OrderDiscount, OrderDiscountEto> |
|||
{ |
|||
public override partial OrderDiscountEto Map(OrderDiscount source); |
|||
|
|||
public override partial void Map(OrderDiscount source, OrderDiscountEto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class OrderExtraFeeToOrderExtraFeeEtoMapper : MapperBase<OrderExtraFee, OrderExtraFeeEto> |
|||
{ |
|||
public override partial OrderExtraFeeEto Map(OrderExtraFee source); |
|||
|
|||
public override partial void Map(OrderExtraFee source, OrderExtraFeeEto destination); |
|||
} |
|||
} |
|||
@ -1,16 +0,0 @@ |
|||
using EasyAbp.EShop.Orders.Orders.Dtos; |
|||
using AutoMapper; |
|||
using Volo.Abp.ObjectExtending; |
|||
|
|||
namespace EasyAbp.EShop.Orders.Web |
|||
{ |
|||
public class OrdersWebAutoMapperProfile : Profile |
|||
{ |
|||
public OrdersWebAutoMapperProfile() |
|||
{ |
|||
/* You can configure your AutoMapper mapping configuration here. |
|||
* Alternatively, you can split your mapping configurations |
|||
* into multiple profile classes for a better organization. */ |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,32 @@ |
|||
using System; |
|||
using EasyAbp.EShop.Orders.Orders.Dtos; |
|||
using Shouldly; |
|||
using Volo.Abp.ObjectMapping; |
|||
using Xunit; |
|||
|
|||
namespace EasyAbp.EShop.Orders.Orders |
|||
{ |
|||
public class OrderExtraFeeMapperlyTests : OrdersApplicationTestBase |
|||
{ |
|||
private readonly IObjectMapper<EShopOrdersApplicationModule> _objectMapper; |
|||
|
|||
public OrderExtraFeeMapperlyTests() |
|||
{ |
|||
_objectMapper = GetRequiredService<IObjectMapper<EShopOrdersApplicationModule>>(); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Should_Map_OrderExtraFee_To_OrderExtraFeeDto() |
|||
{ |
|||
var entity = new OrderExtraFee(Guid.NewGuid(), "Shipping", "shipping-key", "Shipping Fee", 12.5m); |
|||
|
|||
var dto = _objectMapper.Map<OrderExtraFee, OrderExtraFeeDto>(entity); |
|||
|
|||
dto.ShouldNotBeNull(); |
|||
dto.Name.ShouldBe("Shipping"); |
|||
dto.Key.ShouldBe("shipping-key"); |
|||
dto.DisplayName.ShouldBe("Shipping Fee"); |
|||
dto.Fee.ShouldBe(12.5m); |
|||
} |
|||
} |
|||
} |
|||
@ -1,23 +0,0 @@ |
|||
using EasyAbp.EShop.Payments.Payments; |
|||
using EasyAbp.EShop.Payments.Payments.Dtos; |
|||
using EasyAbp.EShop.Payments.Refunds; |
|||
using EasyAbp.EShop.Payments.Refunds.Dtos; |
|||
using AutoMapper; |
|||
|
|||
namespace EasyAbp.EShop.Payments |
|||
{ |
|||
public class PaymentsApplicationAutoMapperProfile : Profile |
|||
{ |
|||
public PaymentsApplicationAutoMapperProfile() |
|||
{ |
|||
/* You can configure your AutoMapper mapping configuration here. |
|||
* Alternatively, you can split your mapping configurations |
|||
* into multiple profile classes for a better organization. */ |
|||
CreateMap<Payment, PaymentDto>(); |
|||
CreateMap<PaymentItem, PaymentItemDto>(); |
|||
CreateMap<Refund, RefundDto>(); |
|||
CreateMap<RefundItem, RefundItemDto>(); |
|||
CreateMap<RefundItemOrderLine, RefundItemOrderLineDto>(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,49 @@ |
|||
using EasyAbp.EShop.Payments.Payments; |
|||
using EasyAbp.EShop.Payments.Payments.Dtos; |
|||
using EasyAbp.EShop.Payments.Refunds; |
|||
using EasyAbp.EShop.Payments.Refunds.Dtos; |
|||
using Riok.Mapperly.Abstractions; |
|||
using Volo.Abp.Mapperly; |
|||
|
|||
namespace EasyAbp.EShop.Payments |
|||
{ |
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class PaymentToPaymentDtoMapper : MapperBase<Payment, PaymentDto> |
|||
{ |
|||
public override partial PaymentDto Map(Payment source); |
|||
|
|||
public override partial void Map(Payment source, PaymentDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class PaymentItemToPaymentItemDtoMapper : MapperBase<PaymentItem, PaymentItemDto> |
|||
{ |
|||
public override partial PaymentItemDto Map(PaymentItem source); |
|||
|
|||
public override partial void Map(PaymentItem source, PaymentItemDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class RefundToRefundDtoMapper : MapperBase<Refund, RefundDto> |
|||
{ |
|||
public override partial RefundDto Map(Refund source); |
|||
|
|||
public override partial void Map(Refund source, RefundDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class RefundItemToRefundItemDtoMapper : MapperBase<RefundItem, RefundItemDto> |
|||
{ |
|||
public override partial RefundItemDto Map(RefundItem source); |
|||
|
|||
public override partial void Map(RefundItem source, RefundItemDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class RefundItemOrderLineToRefundItemOrderLineDtoMapper : MapperBase<RefundItemOrderLine, RefundItemOrderLineDto> |
|||
{ |
|||
public override partial RefundItemOrderLineDto Map(RefundItemOrderLine source); |
|||
|
|||
public override partial void Map(RefundItemOrderLine source, RefundItemOrderLineDto destination); |
|||
} |
|||
} |
|||
@ -1,39 +0,0 @@ |
|||
using AutoMapper; |
|||
using EasyAbp.EShop.Payments.Payments; |
|||
using EasyAbp.EShop.Payments.Refunds; |
|||
using EasyAbp.PaymentService.Payments; |
|||
using EasyAbp.PaymentService.Refunds; |
|||
using Volo.Abp.AutoMapper; |
|||
|
|||
namespace EasyAbp.EShop.Payments |
|||
{ |
|||
public class PaymentsDomainAutoMapperProfile : Profile |
|||
{ |
|||
public PaymentsDomainAutoMapperProfile() |
|||
{ |
|||
/* You can configure your AutoMapper mapping configuration here. |
|||
* Alternatively, you can split your mapping configurations |
|||
* into multiple profile classes for a better organization. */ |
|||
|
|||
CreateMap<PaymentEto, Payment>(MemberList.Source) |
|||
.ForSourceMember(x => x.PaymentItems, x => x.DoNotValidate()) |
|||
.Ignore(x => x.PaymentItems); |
|||
CreateMap<PaymentItemEto, PaymentItem>(MemberList.Source) |
|||
.Ignore(x => x.StoreId); |
|||
|
|||
CreateMap<RefundEto, Refund>(MemberList.Source) |
|||
.ForSourceMember(x => x.RefundItems, x => x.DoNotValidate()) |
|||
.Ignore(x => x.RefundItems); |
|||
CreateMap<RefundItemEto, RefundItem>(MemberList.Source) |
|||
.Ignore(x => x.StoreId) |
|||
.Ignore(x => x.OrderId); |
|||
|
|||
CreateMap<Payment, EShopPaymentEto>(); |
|||
CreateMap<PaymentItem, EShopPaymentItemEto>(); |
|||
CreateMap<Refund, EShopRefundEto>(); |
|||
CreateMap<RefundItem, EShopRefundItemEto>(); |
|||
CreateMap<RefundItemOrderLine, RefundItemOrderLineEto>(); |
|||
CreateMap<RefundItemOrderExtraFee, RefundItemOrderExtraFeeEto>(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,55 @@ |
|||
using EasyAbp.EShop.Payments.Payments; |
|||
using EasyAbp.EShop.Payments.Refunds; |
|||
using Riok.Mapperly.Abstractions; |
|||
using Volo.Abp.Mapperly; |
|||
|
|||
namespace EasyAbp.EShop.Payments |
|||
{ |
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class PaymentToEShopPaymentEtoMapper : MapperBase<Payment, EShopPaymentEto> |
|||
{ |
|||
public override partial EShopPaymentEto Map(Payment source); |
|||
|
|||
public override partial void Map(Payment source, EShopPaymentEto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class PaymentItemToEShopPaymentItemEtoMapper : MapperBase<PaymentItem, EShopPaymentItemEto> |
|||
{ |
|||
public override partial EShopPaymentItemEto Map(PaymentItem source); |
|||
|
|||
public override partial void Map(PaymentItem source, EShopPaymentItemEto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class RefundToEShopRefundEtoMapper : MapperBase<Refund, EShopRefundEto> |
|||
{ |
|||
public override partial EShopRefundEto Map(Refund source); |
|||
|
|||
public override partial void Map(Refund source, EShopRefundEto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class RefundItemToEShopRefundItemEtoMapper : MapperBase<RefundItem, EShopRefundItemEto> |
|||
{ |
|||
public override partial EShopRefundItemEto Map(RefundItem source); |
|||
|
|||
public override partial void Map(RefundItem source, EShopRefundItemEto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class RefundItemOrderLineToRefundItemOrderLineEtoMapper : MapperBase<RefundItemOrderLine, RefundItemOrderLineEto> |
|||
{ |
|||
public override partial RefundItemOrderLineEto Map(RefundItemOrderLine source); |
|||
|
|||
public override partial void Map(RefundItemOrderLine source, RefundItemOrderLineEto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class RefundItemOrderExtraFeeToRefundItemOrderExtraFeeEtoMapper : MapperBase<RefundItemOrderExtraFee, RefundItemOrderExtraFeeEto> |
|||
{ |
|||
public override partial RefundItemOrderExtraFeeEto Map(RefundItemOrderExtraFee source); |
|||
|
|||
public override partial void Map(RefundItemOrderExtraFee source, RefundItemOrderExtraFeeEto destination); |
|||
} |
|||
} |
|||
@ -1,15 +0,0 @@ |
|||
using EasyAbp.EShop.Payments.Refunds.Dtos; |
|||
using AutoMapper; |
|||
|
|||
namespace EasyAbp.EShop.Payments.Web |
|||
{ |
|||
public class PaymentsWebAutoMapperProfile : Profile |
|||
{ |
|||
public PaymentsWebAutoMapperProfile() |
|||
{ |
|||
/* You can configure your AutoMapper mapping configuration here. |
|||
* Alternatively, you can split your mapping configurations |
|||
* into multiple profile classes for a better organization. */ |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,33 @@ |
|||
using System; |
|||
using EasyAbp.EShop.Payments.Payments.Dtos; |
|||
using Shouldly; |
|||
using Volo.Abp.ObjectMapping; |
|||
using Xunit; |
|||
|
|||
namespace EasyAbp.EShop.Payments.Payments |
|||
{ |
|||
public class PaymentItemMapperlyTests : PaymentsApplicationTestBase |
|||
{ |
|||
private readonly IObjectMapper<EShopPaymentsApplicationModule> _objectMapper; |
|||
|
|||
public PaymentItemMapperlyTests() |
|||
{ |
|||
_objectMapper = GetRequiredService<IObjectMapper<EShopPaymentsApplicationModule>>(); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Should_Map_PaymentItem_To_PaymentItemDto() |
|||
{ |
|||
var entity = new PaymentItem(Guid.NewGuid(), "TestItemType", "item-key", 100m, 10m, 90m, 0m, 0m); |
|||
|
|||
var dto = _objectMapper.Map<PaymentItem, PaymentItemDto>(entity); |
|||
|
|||
dto.ShouldNotBeNull(); |
|||
dto.Id.ShouldBe(entity.Id); |
|||
dto.ItemType.ShouldBe("TestItemType"); |
|||
dto.ItemKey.ShouldBe("item-key"); |
|||
dto.OriginalPaymentAmount.ShouldBe(100m); |
|||
dto.ActualPaymentAmount.ShouldBe(90m); |
|||
} |
|||
} |
|||
} |
|||
@ -1,14 +0,0 @@ |
|||
using AutoMapper; |
|||
|
|||
namespace EasyAbp.EShop.Plugins |
|||
{ |
|||
public class PluginsApplicationAutoMapperProfile : Profile |
|||
{ |
|||
public PluginsApplicationAutoMapperProfile() |
|||
{ |
|||
/* You can configure your AutoMapper mapping configuration here. |
|||
* Alternatively, you can split your mapping configurations |
|||
* into multiple profile classes for a better organization. */ |
|||
} |
|||
} |
|||
} |
|||
@ -1,14 +0,0 @@ |
|||
using AutoMapper; |
|||
|
|||
namespace EasyAbp.EShop.Plugins.Web |
|||
{ |
|||
public class PluginsWebAutoMapperProfile : Profile |
|||
{ |
|||
public PluginsWebAutoMapperProfile() |
|||
{ |
|||
/* You can configure your AutoMapper mapping configuration here. |
|||
* Alternatively, you can split your mapping configurations |
|||
* into multiple profile classes for a better organization. */ |
|||
} |
|||
} |
|||
} |
|||
@ -1,50 +0,0 @@ |
|||
using AutoMapper; |
|||
using EasyAbp.EShop.Products.Categories; |
|||
using EasyAbp.EShop.Products.Categories.Dtos; |
|||
using EasyAbp.EShop.Products.ProductCategories; |
|||
using EasyAbp.EShop.Products.ProductCategories.Dtos; |
|||
using EasyAbp.EShop.Products.ProductDetailHistories; |
|||
using EasyAbp.EShop.Products.ProductDetailHistories.Dtos; |
|||
using EasyAbp.EShop.Products.ProductDetails; |
|||
using EasyAbp.EShop.Products.ProductDetails.Dtos; |
|||
using EasyAbp.EShop.Products.ProductHistories; |
|||
using EasyAbp.EShop.Products.ProductHistories.Dtos; |
|||
using EasyAbp.EShop.Products.Products; |
|||
using EasyAbp.EShop.Products.Products.Dtos; |
|||
using Volo.Abp.AutoMapper; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace EasyAbp.EShop.Products |
|||
{ |
|||
public class ProductsApplicationAutoMapperProfile : Profile, ISingletonDependency |
|||
{ |
|||
public ProductsApplicationAutoMapperProfile() |
|||
{ |
|||
/* 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>() |
|||
.Ignore(dto => dto.Price) |
|||
.Ignore(dto => dto.Inventory) |
|||
.Ignore(dto => dto.Sold); |
|||
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>(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,138 @@ |
|||
using EasyAbp.EShop.Products.Categories; |
|||
using EasyAbp.EShop.Products.Categories.Dtos; |
|||
using EasyAbp.EShop.Products.ProductCategories; |
|||
using EasyAbp.EShop.Products.ProductCategories.Dtos; |
|||
using EasyAbp.EShop.Products.ProductDetailHistories; |
|||
using EasyAbp.EShop.Products.ProductDetailHistories.Dtos; |
|||
using EasyAbp.EShop.Products.ProductDetails; |
|||
using EasyAbp.EShop.Products.ProductDetails.Dtos; |
|||
using EasyAbp.EShop.Products.ProductHistories; |
|||
using EasyAbp.EShop.Products.ProductHistories.Dtos; |
|||
using EasyAbp.EShop.Products.Products; |
|||
using EasyAbp.EShop.Products.Products.Dtos; |
|||
using Riok.Mapperly.Abstractions; |
|||
using Volo.Abp.Mapperly; |
|||
|
|||
namespace EasyAbp.EShop.Products |
|||
{ |
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class ProductToProductDtoMapper : MapperBase<Product, ProductDto> |
|||
{ |
|||
[UseMapper] private readonly ProductSkuToProductSkuDtoMapper _productSkuMapper; |
|||
[UseMapper] private readonly ProductAttributeToProductAttributeDtoMapper _productAttributeMapper; |
|||
|
|||
public ProductToProductDtoMapper( |
|||
ProductSkuToProductSkuDtoMapper productSkuMapper, |
|||
ProductAttributeToProductAttributeDtoMapper productAttributeMapper) |
|||
{ |
|||
_productSkuMapper = productSkuMapper; |
|||
_productAttributeMapper = productAttributeMapper; |
|||
} |
|||
|
|||
[MapperIgnoreTarget(nameof(ProductDto.ProductGroupDisplayName))] |
|||
[MapperIgnoreTarget(nameof(ProductDto.Sold))] |
|||
[MapperIgnoreTarget(nameof(ProductDto.MinimumPrice))] |
|||
[MapperIgnoreTarget(nameof(ProductDto.MaximumPrice))] |
|||
public override partial ProductDto Map(Product source); |
|||
|
|||
[MapperIgnoreTarget(nameof(ProductDto.ProductGroupDisplayName))] |
|||
[MapperIgnoreTarget(nameof(ProductDto.Sold))] |
|||
[MapperIgnoreTarget(nameof(ProductDto.MinimumPrice))] |
|||
[MapperIgnoreTarget(nameof(ProductDto.MaximumPrice))] |
|||
public override partial void Map(Product source, ProductDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class ProductDetailToProductDetailDtoMapper : MapperBase<ProductDetail, ProductDetailDto> |
|||
{ |
|||
public override partial ProductDetailDto Map(ProductDetail source); |
|||
|
|||
public override partial void Map(ProductDetail source, ProductDetailDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class ProductAttributeToProductAttributeDtoMapper : MapperBase<ProductAttribute, ProductAttributeDto> |
|||
{ |
|||
[UseMapper] private readonly ProductAttributeOptionToProductAttributeOptionDtoMapper _optionMapper; |
|||
|
|||
public ProductAttributeToProductAttributeDtoMapper( |
|||
ProductAttributeOptionToProductAttributeOptionDtoMapper optionMapper) |
|||
{ |
|||
_optionMapper = optionMapper; |
|||
} |
|||
|
|||
public override partial ProductAttributeDto Map(ProductAttribute source); |
|||
|
|||
public override partial void Map(ProductAttribute source, ProductAttributeDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class ProductAttributeOptionToProductAttributeOptionDtoMapper : MapperBase<ProductAttributeOption, ProductAttributeOptionDto> |
|||
{ |
|||
public override partial ProductAttributeOptionDto Map(ProductAttributeOption source); |
|||
|
|||
public override partial void Map(ProductAttributeOption source, ProductAttributeOptionDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class ProductSkuToProductSkuDtoMapper : MapperBase<ProductSku, ProductSkuDto> |
|||
{ |
|||
[MapperIgnoreTarget(nameof(ProductSkuDto.Price))] |
|||
[MapperIgnoreTarget(nameof(ProductSkuDto.Inventory))] |
|||
[MapperIgnoreTarget(nameof(ProductSkuDto.Sold))] |
|||
public override partial ProductSkuDto Map(ProductSku source); |
|||
|
|||
[MapperIgnoreTarget(nameof(ProductSkuDto.Price))] |
|||
[MapperIgnoreTarget(nameof(ProductSkuDto.Inventory))] |
|||
[MapperIgnoreTarget(nameof(ProductSkuDto.Sold))] |
|||
public override partial void Map(ProductSku source, ProductSkuDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class CategoryToCategoryDtoMapper : MapperBase<Category, CategoryDto> |
|||
{ |
|||
public override partial CategoryDto Map(Category source); |
|||
|
|||
public override partial void Map(Category source, CategoryDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class CategoryToCategorySummaryDtoMapper : MapperBase<Category, CategorySummaryDto> |
|||
{ |
|||
public override partial CategorySummaryDto Map(Category source); |
|||
|
|||
public override partial void Map(Category source, CategorySummaryDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class ProductCategoryToProductCategoryDtoMapper : MapperBase<ProductCategory, ProductCategoryDto> |
|||
{ |
|||
public override partial ProductCategoryDto Map(ProductCategory source); |
|||
|
|||
public override partial void Map(ProductCategory source, ProductCategoryDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class ProductHistoryToProductHistoryDtoMapper : MapperBase<ProductHistory, ProductHistoryDto> |
|||
{ |
|||
public override partial ProductHistoryDto Map(ProductHistory source); |
|||
|
|||
public override partial void Map(ProductHistory source, ProductHistoryDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class ProductDetailHistoryToProductDetailHistoryDtoMapper : MapperBase<ProductDetailHistory, ProductDetailHistoryDto> |
|||
{ |
|||
public override partial ProductDetailHistoryDto Map(ProductDetailHistory source); |
|||
|
|||
public override partial void Map(ProductDetailHistory source, ProductDetailHistoryDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class ProductViewToProductViewDtoMapper : MapperBase<ProductView, ProductViewDto> |
|||
{ |
|||
public override partial ProductViewDto Map(ProductView source); |
|||
|
|||
public override partial void Map(ProductView source, ProductViewDto destination); |
|||
} |
|||
} |
|||
@ -1,19 +0,0 @@ |
|||
using AutoMapper; |
|||
using EasyAbp.EShop.Products.Products; |
|||
|
|||
namespace EasyAbp.EShop.Products |
|||
{ |
|||
public class ProductsDomainAutoMapperProfile : Profile |
|||
{ |
|||
public ProductsDomainAutoMapperProfile() |
|||
{ |
|||
/* 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, ProductEto>(); |
|||
CreateMap<ProductAttribute, ProductAttributeEto>(); |
|||
CreateMap<ProductAttributeOption, ProductAttributeOptionEto>(); |
|||
CreateMap<ProductSku, ProductSkuEto>(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,38 @@ |
|||
using EasyAbp.EShop.Products.Products; |
|||
using Riok.Mapperly.Abstractions; |
|||
using Volo.Abp.Mapperly; |
|||
|
|||
namespace EasyAbp.EShop.Products |
|||
{ |
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class ProductToProductEtoMapper : MapperBase<Product, ProductEto> |
|||
{ |
|||
public override partial ProductEto Map(Product source); |
|||
|
|||
public override partial void Map(Product source, ProductEto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class ProductAttributeToProductAttributeEtoMapper : MapperBase<ProductAttribute, ProductAttributeEto> |
|||
{ |
|||
public override partial ProductAttributeEto Map(ProductAttribute source); |
|||
|
|||
public override partial void Map(ProductAttribute source, ProductAttributeEto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class ProductAttributeOptionToProductAttributeOptionEtoMapper : MapperBase<ProductAttributeOption, ProductAttributeOptionEto> |
|||
{ |
|||
public override partial ProductAttributeOptionEto Map(ProductAttributeOption source); |
|||
|
|||
public override partial void Map(ProductAttributeOption source, ProductAttributeOptionEto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class ProductSkuToProductSkuEtoMapper : MapperBase<ProductSku, ProductSkuEto> |
|||
{ |
|||
public override partial ProductSkuEto Map(ProductSku source); |
|||
|
|||
public override partial void Map(ProductSku source, ProductSkuEto destination); |
|||
} |
|||
} |
|||
@ -1,82 +0,0 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using EasyAbp.EShop.Products.Products.Dtos; |
|||
using EasyAbp.EShop.Products.Categories.Dtos; |
|||
using AutoMapper; |
|||
using EasyAbp.EShop.Products.ProductDetails.Dtos; |
|||
using EasyAbp.EShop.Products.Web.Pages.EShop.Products.Categories.Category.ViewModels; |
|||
using EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.Product.ViewModels; |
|||
using EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.ProductSku.ViewModels; |
|||
using Volo.Abp.AutoMapper; |
|||
|
|||
namespace EasyAbp.EShop.Products.Web |
|||
{ |
|||
public class ProductsWebAutoMapperProfile : Profile |
|||
{ |
|||
public ProductsWebAutoMapperProfile() |
|||
{ |
|||
/* You can configure your AutoMapper mapping configuration here. |
|||
* Alternatively, you can split your mapping configurations |
|||
* into multiple profile classes for a better organization. */ |
|||
CreateMap<ProductDto, CreateEditProductViewModel>() |
|||
.Ignore(model => model.CategoryIds) |
|||
.Ignore(model => model.ProductDetail) |
|||
.ForSourceMember(dto => dto.Sold, opt => opt.DoNotValidate()) |
|||
.ForSourceMember(dto => dto.ProductDetailId, opt => opt.DoNotValidate()) |
|||
// .Ignore(x => x.ProductAttributes);
|
|||
.ForMember(dest => dest.ProductAttributeNames, |
|||
opt => opt.MapFrom(source => |
|||
source.ProductAttributes.Select(x => x.DisplayName).JoinAsString(","))) |
|||
.ForMember(dest => dest.ProductAttributeOptionNames, |
|||
opt => opt.MapFrom(x => |
|||
x.ProductAttributes |
|||
.Select(a => a.ProductAttributeOptions.Select(o => o.DisplayName).JoinAsString(",")) |
|||
.JoinAsString(Environment.NewLine))); |
|||
CreateMap<CreateEditProductViewModel, CreateUpdateProductDto>() |
|||
.Ignore(dto => dto.ExtraProperties) |
|||
.Ignore(dto => dto.ProductDetailId) |
|||
.ForSourceMember(model => model.ProductDetail, opt => opt.DoNotValidate()) |
|||
.ForMember(dest => dest.ProductAttributes, |
|||
opt => opt.MapFrom(x => |
|||
x.ProductAttributeNames.Split(",", StringSplitOptions.RemoveEmptyEntries).Select((s, i) => |
|||
new CreateUpdateProductAttributeDto |
|||
{ |
|||
DisplayName = s, |
|||
ProductAttributeOptions = new List<CreateUpdateProductAttributeOptionDto>( |
|||
x.ProductAttributeOptionNames.SplitToLines(StringSplitOptions.RemoveEmptyEntries)[i] |
|||
.Split(",", StringSplitOptions.RemoveEmptyEntries).Select(o => |
|||
new CreateUpdateProductAttributeOptionDto {DisplayName = o.RemovePostFix("\r")})) |
|||
}))); |
|||
CreateMap<ProductDetailDto, CreateEditProductDetailViewModel>(); |
|||
CreateMap<CreateEditProductDetailViewModel, CreateUpdateProductDetailDto>() |
|||
.Ignore(dto => dto.ExtraProperties); |
|||
CreateMap<CreateEditSkuProductDetailViewModel, CreateUpdateProductDetailDto>() |
|||
.Ignore(dto => dto.ExtraProperties); |
|||
CreateMap<ProductAttributeDto, CreateEditProductAttributeViewModel>(); |
|||
CreateMap<CreateEditProductAttributeViewModel, CreateUpdateProductAttributeDto>() |
|||
.Ignore(dto => dto.ExtraProperties); |
|||
CreateMap<CreateProductSkuViewModel, CreateProductSkuDto>() |
|||
.Ignore(dto => dto.ExtraProperties) |
|||
.Ignore(dto => dto.ProductDetailId) |
|||
.ForSourceMember(model => model.ProductDetail, opt => opt.DoNotValidate()) |
|||
.ForSourceMember(model => model.Inventory, opt => opt.DoNotValidate()) |
|||
.Ignore(dto => dto.AttributeOptionIds); |
|||
CreateMap<EditProductSkuViewModel, UpdateProductSkuDto>() |
|||
.Ignore(dto => dto.ProductDetailId) |
|||
.ForSourceMember(model => model.ProductDetail, opt => opt.DoNotValidate()) |
|||
.Ignore(dto => dto.ExtraProperties); |
|||
CreateMap<ProductSkuDto, EditProductSkuViewModel>() |
|||
.Ignore(x => x.ProductDetail) |
|||
.ForSourceMember(dto => dto.AttributeOptionIds, opt => opt.DoNotValidate()) |
|||
.ForSourceMember(dto => dto.Inventory, opt => opt.DoNotValidate()) |
|||
.ForSourceMember(dto => dto.Sold, opt => opt.DoNotValidate()); |
|||
CreateMap<ProductAttributeOptionDto, CreateEditProductAttributeOptionViewModel>(); |
|||
CreateMap<CreateEditProductAttributeOptionViewModel, CreateUpdateProductAttributeOptionDto>() |
|||
.Ignore(dto => dto.ExtraProperties); |
|||
CreateMap<CategoryDto, CreateEditCategoryViewModel>(MemberList.Destination); |
|||
CreateMap<CreateEditCategoryViewModel, CreateUpdateCategoryDto>() |
|||
.Ignore(dto => dto.ExtraProperties); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,186 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using EasyAbp.EShop.Products.Categories.Dtos; |
|||
using EasyAbp.EShop.Products.ProductDetails.Dtos; |
|||
using EasyAbp.EShop.Products.Products.Dtos; |
|||
using EasyAbp.EShop.Products.Web.Pages.EShop.Products.Categories.Category.ViewModels; |
|||
using EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.Product.ViewModels; |
|||
using EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.ProductSku.ViewModels; |
|||
using Riok.Mapperly.Abstractions; |
|||
using Volo.Abp.Mapperly; |
|||
|
|||
namespace EasyAbp.EShop.Products.Web |
|||
{ |
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class ProductDtoToCreateEditProductViewModelMapper : MapperBase<ProductDto, CreateEditProductViewModel> |
|||
{ |
|||
[MapperIgnoreTarget(nameof(CreateEditProductViewModel.CategoryIds))] |
|||
[MapperIgnoreTarget(nameof(CreateEditProductViewModel.ProductDetail))] |
|||
[MapperIgnoreTarget(nameof(CreateEditProductViewModel.ProductAttributeNames))] |
|||
[MapperIgnoreTarget(nameof(CreateEditProductViewModel.ProductAttributeOptionNames))] |
|||
public override partial CreateEditProductViewModel Map(ProductDto source); |
|||
|
|||
[MapperIgnoreTarget(nameof(CreateEditProductViewModel.CategoryIds))] |
|||
[MapperIgnoreTarget(nameof(CreateEditProductViewModel.ProductDetail))] |
|||
[MapperIgnoreTarget(nameof(CreateEditProductViewModel.ProductAttributeNames))] |
|||
[MapperIgnoreTarget(nameof(CreateEditProductViewModel.ProductAttributeOptionNames))] |
|||
public override partial void Map(ProductDto source, CreateEditProductViewModel destination); |
|||
|
|||
public override void AfterMap(ProductDto source, CreateEditProductViewModel destination) |
|||
{ |
|||
destination.ProductAttributeNames = |
|||
source.ProductAttributes.Select(x => x.DisplayName).JoinAsString(","); |
|||
|
|||
destination.ProductAttributeOptionNames = source.ProductAttributes |
|||
.Select(a => a.ProductAttributeOptions.Select(o => o.DisplayName).JoinAsString(",")) |
|||
.JoinAsString(Environment.NewLine); |
|||
} |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class CreateEditProductViewModelToCreateUpdateProductDtoMapper : MapperBase<CreateEditProductViewModel, CreateUpdateProductDto> |
|||
{ |
|||
[MapperIgnoreTarget(nameof(CreateUpdateProductDto.ExtraProperties))] |
|||
[MapperIgnoreTarget(nameof(CreateUpdateProductDto.ProductDetailId))] |
|||
[MapperIgnoreTarget(nameof(CreateUpdateProductDto.ProductAttributes))] |
|||
public override partial CreateUpdateProductDto Map(CreateEditProductViewModel source); |
|||
|
|||
[MapperIgnoreTarget(nameof(CreateUpdateProductDto.ExtraProperties))] |
|||
[MapperIgnoreTarget(nameof(CreateUpdateProductDto.ProductDetailId))] |
|||
[MapperIgnoreTarget(nameof(CreateUpdateProductDto.ProductAttributes))] |
|||
public override partial void Map(CreateEditProductViewModel source, CreateUpdateProductDto destination); |
|||
|
|||
public override void AfterMap(CreateEditProductViewModel source, CreateUpdateProductDto destination) |
|||
{ |
|||
destination.ProductAttributes = source.ProductAttributeNames |
|||
.Split(",", StringSplitOptions.RemoveEmptyEntries).Select((s, i) => |
|||
new CreateUpdateProductAttributeDto |
|||
{ |
|||
DisplayName = s, |
|||
ProductAttributeOptions = new List<CreateUpdateProductAttributeOptionDto>( |
|||
source.ProductAttributeOptionNames.SplitToLines(StringSplitOptions.RemoveEmptyEntries)[i] |
|||
.Split(",", StringSplitOptions.RemoveEmptyEntries).Select(o => |
|||
new CreateUpdateProductAttributeOptionDto { DisplayName = o.RemovePostFix("\r") })) |
|||
}).ToList(); |
|||
} |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class ProductDetailDtoToCreateEditProductDetailViewModelMapper : MapperBase<ProductDetailDto, CreateEditProductDetailViewModel> |
|||
{ |
|||
public override partial CreateEditProductDetailViewModel Map(ProductDetailDto source); |
|||
|
|||
public override partial void Map(ProductDetailDto source, CreateEditProductDetailViewModel destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class CreateEditProductDetailViewModelToCreateUpdateProductDetailDtoMapper : MapperBase<CreateEditProductDetailViewModel, CreateUpdateProductDetailDto> |
|||
{ |
|||
[MapperIgnoreTarget(nameof(CreateUpdateProductDetailDto.ExtraProperties))] |
|||
public override partial CreateUpdateProductDetailDto Map(CreateEditProductDetailViewModel source); |
|||
|
|||
[MapperIgnoreTarget(nameof(CreateUpdateProductDetailDto.ExtraProperties))] |
|||
public override partial void Map(CreateEditProductDetailViewModel source, CreateUpdateProductDetailDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class CreateEditSkuProductDetailViewModelToCreateUpdateProductDetailDtoMapper : MapperBase<CreateEditSkuProductDetailViewModel, CreateUpdateProductDetailDto> |
|||
{ |
|||
[MapperIgnoreTarget(nameof(CreateUpdateProductDetailDto.ExtraProperties))] |
|||
public override partial CreateUpdateProductDetailDto Map(CreateEditSkuProductDetailViewModel source); |
|||
|
|||
[MapperIgnoreTarget(nameof(CreateUpdateProductDetailDto.ExtraProperties))] |
|||
public override partial void Map(CreateEditSkuProductDetailViewModel source, CreateUpdateProductDetailDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class ProductAttributeDtoToCreateEditProductAttributeViewModelMapper : MapperBase<ProductAttributeDto, CreateEditProductAttributeViewModel> |
|||
{ |
|||
public override partial CreateEditProductAttributeViewModel Map(ProductAttributeDto source); |
|||
|
|||
public override partial void Map(ProductAttributeDto source, CreateEditProductAttributeViewModel destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class CreateEditProductAttributeViewModelToCreateUpdateProductAttributeDtoMapper : MapperBase<CreateEditProductAttributeViewModel, CreateUpdateProductAttributeDto> |
|||
{ |
|||
[MapperIgnoreTarget(nameof(CreateUpdateProductAttributeDto.ExtraProperties))] |
|||
public override partial CreateUpdateProductAttributeDto Map(CreateEditProductAttributeViewModel source); |
|||
|
|||
[MapperIgnoreTarget(nameof(CreateUpdateProductAttributeDto.ExtraProperties))] |
|||
public override partial void Map(CreateEditProductAttributeViewModel source, CreateUpdateProductAttributeDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class CreateProductSkuViewModelToCreateProductSkuDtoMapper : MapperBase<CreateProductSkuViewModel, CreateProductSkuDto> |
|||
{ |
|||
[MapperIgnoreTarget(nameof(CreateProductSkuDto.ExtraProperties))] |
|||
[MapperIgnoreTarget(nameof(CreateProductSkuDto.ProductDetailId))] |
|||
[MapperIgnoreTarget(nameof(CreateProductSkuDto.AttributeOptionIds))] |
|||
public override partial CreateProductSkuDto Map(CreateProductSkuViewModel source); |
|||
|
|||
[MapperIgnoreTarget(nameof(CreateProductSkuDto.ExtraProperties))] |
|||
[MapperIgnoreTarget(nameof(CreateProductSkuDto.ProductDetailId))] |
|||
[MapperIgnoreTarget(nameof(CreateProductSkuDto.AttributeOptionIds))] |
|||
public override partial void Map(CreateProductSkuViewModel source, CreateProductSkuDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class EditProductSkuViewModelToUpdateProductSkuDtoMapper : MapperBase<EditProductSkuViewModel, UpdateProductSkuDto> |
|||
{ |
|||
[MapperIgnoreTarget(nameof(UpdateProductSkuDto.ProductDetailId))] |
|||
[MapperIgnoreTarget(nameof(UpdateProductSkuDto.ExtraProperties))] |
|||
public override partial UpdateProductSkuDto Map(EditProductSkuViewModel source); |
|||
|
|||
[MapperIgnoreTarget(nameof(UpdateProductSkuDto.ProductDetailId))] |
|||
[MapperIgnoreTarget(nameof(UpdateProductSkuDto.ExtraProperties))] |
|||
public override partial void Map(EditProductSkuViewModel source, UpdateProductSkuDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class ProductSkuDtoToEditProductSkuViewModelMapper : MapperBase<ProductSkuDto, EditProductSkuViewModel> |
|||
{ |
|||
[MapperIgnoreTarget(nameof(EditProductSkuViewModel.ProductDetail))] |
|||
public override partial EditProductSkuViewModel Map(ProductSkuDto source); |
|||
|
|||
[MapperIgnoreTarget(nameof(EditProductSkuViewModel.ProductDetail))] |
|||
public override partial void Map(ProductSkuDto source, EditProductSkuViewModel destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class ProductAttributeOptionDtoToCreateEditProductAttributeOptionViewModelMapper : MapperBase<ProductAttributeOptionDto, CreateEditProductAttributeOptionViewModel> |
|||
{ |
|||
public override partial CreateEditProductAttributeOptionViewModel Map(ProductAttributeOptionDto source); |
|||
|
|||
public override partial void Map(ProductAttributeOptionDto source, CreateEditProductAttributeOptionViewModel destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class CreateEditProductAttributeOptionViewModelToCreateUpdateProductAttributeOptionDtoMapper : MapperBase<CreateEditProductAttributeOptionViewModel, CreateUpdateProductAttributeOptionDto> |
|||
{ |
|||
[MapperIgnoreTarget(nameof(CreateUpdateProductAttributeOptionDto.ExtraProperties))] |
|||
public override partial CreateUpdateProductAttributeOptionDto Map(CreateEditProductAttributeOptionViewModel source); |
|||
|
|||
[MapperIgnoreTarget(nameof(CreateUpdateProductAttributeOptionDto.ExtraProperties))] |
|||
public override partial void Map(CreateEditProductAttributeOptionViewModel source, CreateUpdateProductAttributeOptionDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class CategoryDtoToCreateEditCategoryViewModelMapper : MapperBase<CategoryDto, CreateEditCategoryViewModel> |
|||
{ |
|||
public override partial CreateEditCategoryViewModel Map(CategoryDto source); |
|||
|
|||
public override partial void Map(CategoryDto source, CreateEditCategoryViewModel destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class CreateEditCategoryViewModelToCreateUpdateCategoryDtoMapper : MapperBase<CreateEditCategoryViewModel, CreateUpdateCategoryDto> |
|||
{ |
|||
[MapperIgnoreTarget(nameof(CreateUpdateCategoryDto.ExtraProperties))] |
|||
public override partial CreateUpdateCategoryDto Map(CreateEditCategoryViewModel source); |
|||
|
|||
[MapperIgnoreTarget(nameof(CreateUpdateCategoryDto.ExtraProperties))] |
|||
public override partial void Map(CreateEditCategoryViewModel source, CreateUpdateCategoryDto destination); |
|||
} |
|||
} |
|||
@ -0,0 +1,32 @@ |
|||
using System; |
|||
using EasyAbp.EShop.Products.ProductDetails.Dtos; |
|||
using Shouldly; |
|||
using Volo.Abp.ObjectMapping; |
|||
using Xunit; |
|||
|
|||
namespace EasyAbp.EShop.Products.ProductDetails |
|||
{ |
|||
public class ProductDetailMapperlyTests : ProductsApplicationTestBase |
|||
{ |
|||
private readonly IObjectMapper<EShopProductsApplicationModule> _objectMapper; |
|||
|
|||
public ProductDetailMapperlyTests() |
|||
{ |
|||
_objectMapper = GetRequiredService<IObjectMapper<EShopProductsApplicationModule>>(); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Should_Map_ProductDetail_To_ProductDetailDto() |
|||
{ |
|||
var storeId = Guid.NewGuid(); |
|||
var entity = new ProductDetail(Guid.NewGuid(), null, storeId, "A description"); |
|||
|
|||
var dto = _objectMapper.Map<ProductDetail, ProductDetailDto>(entity); |
|||
|
|||
dto.ShouldNotBeNull(); |
|||
dto.Id.ShouldBe(entity.Id); |
|||
dto.StoreId.ShouldBe(storeId); |
|||
dto.Description.ShouldBe("A description"); |
|||
} |
|||
} |
|||
} |
|||
@ -1,31 +0,0 @@ |
|||
using AutoMapper; |
|||
using EasyAbp.EShop.Stores.StoreOwners; |
|||
using EasyAbp.EShop.Stores.StoreOwners.Dtos; |
|||
using EasyAbp.EShop.Stores.Stores; |
|||
using EasyAbp.EShop.Stores.Stores.Dtos; |
|||
using EasyAbp.EShop.Stores.Transactions; |
|||
using EasyAbp.EShop.Stores.Transactions.Dtos; |
|||
using Volo.Abp.AutoMapper; |
|||
using Volo.Abp.ObjectExtending; |
|||
|
|||
namespace EasyAbp.EShop.Stores |
|||
{ |
|||
public class StoresApplicationAutoMapperProfile : Profile |
|||
{ |
|||
public StoresApplicationAutoMapperProfile() |
|||
{ |
|||
/* You can configure your AutoMapper mapping configuration here. |
|||
* Alternatively, you can split your mapping configurations |
|||
* into multiple profile classes for a better organization. */ |
|||
CreateMap<Store, StoreDto>(); |
|||
CreateMap<CreateUpdateStoreDto, Store>(MemberList.Source); |
|||
|
|||
CreateMap<StoreOwner, StoreOwnerDto>() |
|||
.Ignore(dto => dto.OwnerUserName); |
|||
CreateMap<CreateUpdateStoreOwnerDto, StoreOwner>(MemberList.Source); |
|||
|
|||
CreateMap<Transaction, TransactionDto>(); |
|||
CreateMap<CreateUpdateTransactionDto, Transaction>(MemberList.Source); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,37 @@ |
|||
using EasyAbp.EShop.Stores.StoreOwners; |
|||
using EasyAbp.EShop.Stores.StoreOwners.Dtos; |
|||
using EasyAbp.EShop.Stores.Stores; |
|||
using EasyAbp.EShop.Stores.Stores.Dtos; |
|||
using EasyAbp.EShop.Stores.Transactions; |
|||
using EasyAbp.EShop.Stores.Transactions.Dtos; |
|||
using Riok.Mapperly.Abstractions; |
|||
using Volo.Abp.Mapperly; |
|||
|
|||
namespace EasyAbp.EShop.Stores |
|||
{ |
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class StoreToStoreDtoMapper : MapperBase<Store, StoreDto> |
|||
{ |
|||
public override partial StoreDto Map(Store source); |
|||
|
|||
public override partial void Map(Store source, StoreDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class StoreOwnerToStoreOwnerDtoMapper : MapperBase<StoreOwner, StoreOwnerDto> |
|||
{ |
|||
[MapperIgnoreTarget(nameof(StoreOwnerDto.OwnerUserName))] |
|||
public override partial StoreOwnerDto Map(StoreOwner source); |
|||
|
|||
[MapperIgnoreTarget(nameof(StoreOwnerDto.OwnerUserName))] |
|||
public override partial void Map(StoreOwner source, StoreOwnerDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class TransactionToTransactionDtoMapper : MapperBase<Transaction, TransactionDto> |
|||
{ |
|||
public override partial TransactionDto Map(Transaction source); |
|||
|
|||
public override partial void Map(Transaction source, TransactionDto destination); |
|||
} |
|||
} |
|||
@ -1,33 +0,0 @@ |
|||
using EasyAbp.EShop.Stores.Stores.Dtos; |
|||
using AutoMapper; |
|||
using EasyAbp.EShop.Stores.StoreOwners.Dtos; |
|||
using EasyAbp.EShop.Stores.Transactions.Dtos; |
|||
using EasyAbp.EShop.Stores.Web.Pages.EShop.Stores.StoreOwners.StoreOwner.ViewModels; |
|||
using EasyAbp.EShop.Stores.Web.Pages.EShop.Stores.Stores.Store.ViewModels; |
|||
using Volo.Abp.AutoMapper; |
|||
using Volo.Abp.ObjectExtending; |
|||
using EasyAbp.EShop.Stores.Web.Pages.EShop.Stores.Transactions.Transaction.ViewModels; |
|||
|
|||
namespace EasyAbp.EShop.Stores.Web |
|||
{ |
|||
public class StoresWebAutoMapperProfile : Profile |
|||
{ |
|||
public StoresWebAutoMapperProfile() |
|||
{ |
|||
/* You can configure your AutoMapper mapping configuration here. |
|||
* Alternatively, you can split your mapping configurations |
|||
* into multiple profile classes for a better organization. */ |
|||
CreateMap<StoreDto, CreateEditStoreViewModel>(); |
|||
CreateMap<CreateEditStoreViewModel, CreateUpdateStoreDto>() |
|||
.Ignore(dto => dto.ExtraProperties); |
|||
|
|||
CreateMap<StoreOwnerDto, CreateEditStoreOwnerViewModel>(); |
|||
CreateMap<CreateEditStoreOwnerViewModel, CreateUpdateStoreOwnerDto>() |
|||
.Ignore(dto => dto.ExtraProperties); |
|||
|
|||
CreateMap<TransactionDto, CreateEditTransactionViewModel>(); |
|||
CreateMap<CreateEditTransactionViewModel, CreateUpdateTransactionDto>() |
|||
.Ignore(dto => dto.ExtraProperties); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,65 @@ |
|||
using EasyAbp.EShop.Stores.StoreOwners.Dtos; |
|||
using EasyAbp.EShop.Stores.Stores.Dtos; |
|||
using EasyAbp.EShop.Stores.Transactions.Dtos; |
|||
using EasyAbp.EShop.Stores.Web.Pages.EShop.Stores.StoreOwners.StoreOwner.ViewModels; |
|||
using EasyAbp.EShop.Stores.Web.Pages.EShop.Stores.Stores.Store.ViewModels; |
|||
using EasyAbp.EShop.Stores.Web.Pages.EShop.Stores.Transactions.Transaction.ViewModels; |
|||
using Riok.Mapperly.Abstractions; |
|||
using Volo.Abp.Mapperly; |
|||
|
|||
namespace EasyAbp.EShop.Stores.Web |
|||
{ |
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class StoreDtoToCreateEditStoreViewModelMapper : MapperBase<StoreDto, CreateEditStoreViewModel> |
|||
{ |
|||
public override partial CreateEditStoreViewModel Map(StoreDto source); |
|||
|
|||
public override partial void Map(StoreDto source, CreateEditStoreViewModel destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class CreateEditStoreViewModelToCreateUpdateStoreDtoMapper : MapperBase<CreateEditStoreViewModel, CreateUpdateStoreDto> |
|||
{ |
|||
[MapperIgnoreTarget(nameof(CreateUpdateStoreDto.ExtraProperties))] |
|||
public override partial CreateUpdateStoreDto Map(CreateEditStoreViewModel source); |
|||
|
|||
[MapperIgnoreTarget(nameof(CreateUpdateStoreDto.ExtraProperties))] |
|||
public override partial void Map(CreateEditStoreViewModel source, CreateUpdateStoreDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class StoreOwnerDtoToCreateEditStoreOwnerViewModelMapper : MapperBase<StoreOwnerDto, CreateEditStoreOwnerViewModel> |
|||
{ |
|||
public override partial CreateEditStoreOwnerViewModel Map(StoreOwnerDto source); |
|||
|
|||
public override partial void Map(StoreOwnerDto source, CreateEditStoreOwnerViewModel destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class CreateEditStoreOwnerViewModelToCreateUpdateStoreOwnerDtoMapper : MapperBase<CreateEditStoreOwnerViewModel, CreateUpdateStoreOwnerDto> |
|||
{ |
|||
[MapperIgnoreTarget(nameof(CreateUpdateStoreOwnerDto.ExtraProperties))] |
|||
public override partial CreateUpdateStoreOwnerDto Map(CreateEditStoreOwnerViewModel source); |
|||
|
|||
[MapperIgnoreTarget(nameof(CreateUpdateStoreOwnerDto.ExtraProperties))] |
|||
public override partial void Map(CreateEditStoreOwnerViewModel source, CreateUpdateStoreOwnerDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class TransactionDtoToCreateEditTransactionViewModelMapper : MapperBase<TransactionDto, CreateEditTransactionViewModel> |
|||
{ |
|||
public override partial CreateEditTransactionViewModel Map(TransactionDto source); |
|||
|
|||
public override partial void Map(TransactionDto source, CreateEditTransactionViewModel destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class CreateEditTransactionViewModelToCreateUpdateTransactionDtoMapper : MapperBase<CreateEditTransactionViewModel, CreateUpdateTransactionDto> |
|||
{ |
|||
[MapperIgnoreTarget(nameof(CreateUpdateTransactionDto.ExtraProperties))] |
|||
public override partial CreateUpdateTransactionDto Map(CreateEditTransactionViewModel source); |
|||
|
|||
[MapperIgnoreTarget(nameof(CreateUpdateTransactionDto.ExtraProperties))] |
|||
public override partial void Map(CreateEditTransactionViewModel source, CreateUpdateTransactionDto destination); |
|||
} |
|||
} |
|||
@ -0,0 +1,30 @@ |
|||
using System; |
|||
using EasyAbp.EShop.Stores.Stores.Dtos; |
|||
using Shouldly; |
|||
using Volo.Abp.ObjectMapping; |
|||
using Xunit; |
|||
|
|||
namespace EasyAbp.EShop.Stores.Stores |
|||
{ |
|||
public class StoreMapperlyTests : StoresApplicationTestBase |
|||
{ |
|||
private readonly IObjectMapper<EShopStoresApplicationModule> _objectMapper; |
|||
|
|||
public StoreMapperlyTests() |
|||
{ |
|||
_objectMapper = GetRequiredService<IObjectMapper<EShopStoresApplicationModule>>(); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Should_Map_Store_To_StoreDto() |
|||
{ |
|||
var entity = new Store(Guid.NewGuid(), null, "Test Store"); |
|||
|
|||
var dto = _objectMapper.Map<Store, StoreDto>(entity); |
|||
|
|||
dto.ShouldNotBeNull(); |
|||
dto.Id.ShouldBe(entity.Id); |
|||
dto.Name.ShouldBe("Test Store"); |
|||
} |
|||
} |
|||
} |
|||
@ -1,17 +0,0 @@ |
|||
using EasyAbp.EShop.Plugins.Baskets.BasketItems; |
|||
using EasyAbp.EShop.Plugins.Baskets.BasketItems.Dtos; |
|||
using AutoMapper; |
|||
|
|||
namespace EasyAbp.EShop.Plugins.Baskets |
|||
{ |
|||
public class BasketsApplicationAutoMapperProfile : Profile |
|||
{ |
|||
public BasketsApplicationAutoMapperProfile() |
|||
{ |
|||
/* You can configure your AutoMapper mapping configuration here. |
|||
* Alternatively, you can split your mapping configurations |
|||
* into multiple profile classes for a better organization. */ |
|||
CreateMap<BasketItem, BasketItemDto>(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
using EasyAbp.EShop.Plugins.Baskets.BasketItems; |
|||
using EasyAbp.EShop.Plugins.Baskets.BasketItems.Dtos; |
|||
using Riok.Mapperly.Abstractions; |
|||
using Volo.Abp.Mapperly; |
|||
|
|||
namespace EasyAbp.EShop.Plugins.Baskets |
|||
{ |
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class BasketItemToBasketItemDtoMapper : MapperBase<BasketItem, BasketItemDto> |
|||
{ |
|||
public override partial BasketItemDto Map(BasketItem source); |
|||
|
|||
public override partial void Map(BasketItem source, BasketItemDto destination); |
|||
} |
|||
} |
|||
@ -1,26 +0,0 @@ |
|||
using EasyAbp.EShop.Plugins.Baskets.BasketItems.Dtos; |
|||
using AutoMapper; |
|||
using EasyAbp.EShop.Plugins.Baskets.BasketItems; |
|||
using EasyAbp.EShop.Plugins.Baskets.Web.Pages.EShop.Plugins.Baskets.BasketItems.BasketItem.ViewModels; |
|||
using Volo.Abp.AutoMapper; |
|||
|
|||
namespace EasyAbp.EShop.Plugins.Baskets.Web |
|||
{ |
|||
public class BasketsWebAutoMapperProfile : Profile |
|||
{ |
|||
public BasketsWebAutoMapperProfile() |
|||
{ |
|||
/* You can configure your AutoMapper mapping configuration here. |
|||
* Alternatively, you can split your mapping configurations |
|||
* into multiple profile classes for a better organization. */ |
|||
CreateMap<ClientSideBasketItemModel, GenerateClientSideDataItemInput>() |
|||
.Ignore(dto => dto.ExtraProperties); |
|||
CreateMap<BasketItemDto, EditBasketItemViewModel>(); |
|||
CreateMap<CreateBasketItemViewModel, CreateBasketItemDto>() |
|||
.Ignore(dto => dto.UserId) |
|||
.Ignore(dto => dto.ExtraProperties); |
|||
CreateMap<EditBasketItemViewModel, UpdateBasketItemDto>() |
|||
.Ignore(dto => dto.ExtraProperties); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
using EasyAbp.EShop.Plugins.Baskets.BasketItems.Dtos; |
|||
using EasyAbp.EShop.Plugins.Baskets.Web.Pages.EShop.Plugins.Baskets.BasketItems.BasketItem.ViewModels; |
|||
using Riok.Mapperly.Abstractions; |
|||
using Volo.Abp.Mapperly; |
|||
|
|||
namespace EasyAbp.EShop.Plugins.Baskets.Web |
|||
{ |
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class ClientSideBasketItemModelToGenerateClientSideDataItemInputMapper : MapperBase<ClientSideBasketItemModel, GenerateClientSideDataItemInput> |
|||
{ |
|||
[MapperIgnoreTarget(nameof(GenerateClientSideDataItemInput.ExtraProperties))] |
|||
public override partial GenerateClientSideDataItemInput Map(ClientSideBasketItemModel source); |
|||
|
|||
[MapperIgnoreTarget(nameof(GenerateClientSideDataItemInput.ExtraProperties))] |
|||
public override partial void Map(ClientSideBasketItemModel source, GenerateClientSideDataItemInput destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class BasketItemDtoToEditBasketItemViewModelMapper : MapperBase<BasketItemDto, EditBasketItemViewModel> |
|||
{ |
|||
public override partial EditBasketItemViewModel Map(BasketItemDto source); |
|||
|
|||
public override partial void Map(BasketItemDto source, EditBasketItemViewModel destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class CreateBasketItemViewModelToCreateBasketItemDtoMapper : MapperBase<CreateBasketItemViewModel, CreateBasketItemDto> |
|||
{ |
|||
[MapperIgnoreTarget(nameof(CreateBasketItemDto.UserId))] |
|||
[MapperIgnoreTarget(nameof(CreateBasketItemDto.ExtraProperties))] |
|||
public override partial CreateBasketItemDto Map(CreateBasketItemViewModel source); |
|||
|
|||
[MapperIgnoreTarget(nameof(CreateBasketItemDto.UserId))] |
|||
[MapperIgnoreTarget(nameof(CreateBasketItemDto.ExtraProperties))] |
|||
public override partial void Map(CreateBasketItemViewModel source, CreateBasketItemDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class EditBasketItemViewModelToUpdateBasketItemDtoMapper : MapperBase<EditBasketItemViewModel, UpdateBasketItemDto> |
|||
{ |
|||
[MapperIgnoreTarget(nameof(UpdateBasketItemDto.ExtraProperties))] |
|||
public override partial UpdateBasketItemDto Map(EditBasketItemViewModel source); |
|||
|
|||
[MapperIgnoreTarget(nameof(UpdateBasketItemDto.ExtraProperties))] |
|||
public override partial void Map(EditBasketItemViewModel source, UpdateBasketItemDto destination); |
|||
} |
|||
} |
|||
@ -1,33 +0,0 @@ |
|||
using EasyAbp.EShop.Plugins.Booking.ProductAssets; |
|||
using EasyAbp.EShop.Plugins.Booking.ProductAssets.Dtos; |
|||
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories; |
|||
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories.Dtos; |
|||
using EasyAbp.EShop.Plugins.Booking.GrantedStores; |
|||
using EasyAbp.EShop.Plugins.Booking.GrantedStores.Dtos; |
|||
using AutoMapper; |
|||
|
|||
namespace EasyAbp.EShop.Plugins.Booking; |
|||
|
|||
public class BookingApplicationAutoMapperProfile : Profile |
|||
{ |
|||
public BookingApplicationAutoMapperProfile() |
|||
{ |
|||
/* You can configure your AutoMapper mapping configuration here. |
|||
* Alternatively, you can split your mapping configurations |
|||
* into multiple profile classes for a better organization. */ |
|||
CreateMap<ProductAsset, ProductAssetDto>(); |
|||
|
|||
CreateMap<ProductAssetPeriod, ProductAssetPeriodDto>(); |
|||
CreateMap<CreateProductAssetPeriodDto, ProductAssetPeriod>(MemberList.Source); |
|||
CreateMap<UpdateProductAssetPeriodDto, ProductAssetPeriod>(MemberList.Source); |
|||
|
|||
CreateMap<ProductAssetCategory, ProductAssetCategoryDto>(); |
|||
|
|||
CreateMap<ProductAssetCategoryPeriod, ProductAssetCategoryPeriodDto>(); |
|||
CreateMap<CreateProductAssetCategoryPeriodDto, ProductAssetCategoryPeriod>(MemberList.Source); |
|||
CreateMap<UpdateProductAssetCategoryPeriodDto, ProductAssetCategoryPeriod>(MemberList.Source); |
|||
|
|||
CreateMap<GrantedStore, GrantedStoreDto>(); |
|||
CreateMap<CreateUpdateGrantedStoreDto, GrantedStore>(MemberList.Source); |
|||
} |
|||
} |
|||
@ -0,0 +1,64 @@ |
|||
using System.Collections.Generic; |
|||
using EasyAbp.EShop.Plugins.Booking.GrantedStores; |
|||
using EasyAbp.EShop.Plugins.Booking.GrantedStores.Dtos; |
|||
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories; |
|||
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories.Dtos; |
|||
using EasyAbp.EShop.Plugins.Booking.ProductAssets; |
|||
using EasyAbp.EShop.Plugins.Booking.ProductAssets.Dtos; |
|||
using Riok.Mapperly.Abstractions; |
|||
using Volo.Abp.Mapperly; |
|||
|
|||
namespace EasyAbp.EShop.Plugins.Booking |
|||
{ |
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class ProductAssetToProductAssetDtoMapper : MapperBase<ProductAsset, ProductAssetDto> |
|||
{ |
|||
public override partial ProductAssetDto Map(ProductAsset source); |
|||
|
|||
public override partial void Map(ProductAsset source, ProductAssetDto destination); |
|||
|
|||
// Mirror AutoMapper's default of mapping a null source collection to an empty collection.
|
|||
public override void AfterMap(ProductAsset source, ProductAssetDto destination) |
|||
{ |
|||
destination.Periods ??= new List<ProductAssetPeriodDto>(); |
|||
} |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class ProductAssetPeriodToProductAssetPeriodDtoMapper : MapperBase<ProductAssetPeriod, ProductAssetPeriodDto> |
|||
{ |
|||
public override partial ProductAssetPeriodDto Map(ProductAssetPeriod source); |
|||
|
|||
public override partial void Map(ProductAssetPeriod source, ProductAssetPeriodDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class ProductAssetCategoryToProductAssetCategoryDtoMapper : MapperBase<ProductAssetCategory, ProductAssetCategoryDto> |
|||
{ |
|||
public override partial ProductAssetCategoryDto Map(ProductAssetCategory source); |
|||
|
|||
public override partial void Map(ProductAssetCategory source, ProductAssetCategoryDto destination); |
|||
|
|||
// Mirror AutoMapper's default of mapping a null source collection to an empty collection.
|
|||
public override void AfterMap(ProductAssetCategory source, ProductAssetCategoryDto destination) |
|||
{ |
|||
destination.Periods ??= new List<ProductAssetCategoryPeriodDto>(); |
|||
} |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class ProductAssetCategoryPeriodToProductAssetCategoryPeriodDtoMapper : MapperBase<ProductAssetCategoryPeriod, ProductAssetCategoryPeriodDto> |
|||
{ |
|||
public override partial ProductAssetCategoryPeriodDto Map(ProductAssetCategoryPeriod source); |
|||
|
|||
public override partial void Map(ProductAssetCategoryPeriod source, ProductAssetCategoryPeriodDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class GrantedStoreToGrantedStoreDtoMapper : MapperBase<GrantedStore, GrantedStoreDto> |
|||
{ |
|||
public override partial GrantedStoreDto Map(GrantedStore source); |
|||
|
|||
public override partial void Map(GrantedStore source, GrantedStoreDto destination); |
|||
} |
|||
} |
|||
@ -1,39 +0,0 @@ |
|||
using EasyAbp.EShop.Plugins.Booking.ProductAssets.Dtos; |
|||
using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssets.ProductAsset.ViewModels; |
|||
using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssets.ProductAssetPeriod.ViewModels; |
|||
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories.Dtos; |
|||
using AutoMapper; |
|||
using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategory.ViewModels; |
|||
using EasyAbp.EShop.Plugins.Booking.GrantedStores.Dtos; |
|||
using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategoryPeriod.ViewModels; |
|||
using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.GrantedStores.GrantedStore.ViewModels; |
|||
|
|||
namespace EasyAbp.EShop.Plugins.Booking.Web; |
|||
|
|||
public class BookingWebAutoMapperProfile : Profile |
|||
{ |
|||
public BookingWebAutoMapperProfile() |
|||
{ |
|||
/* You can configure your AutoMapper mapping configuration here. |
|||
* Alternatively, you can split your mapping configurations |
|||
* into multiple profile classes for a better organization. */ |
|||
CreateMap<ProductAssetDto, EditProductAssetViewModel>(); |
|||
CreateMap<CreateProductAssetViewModel, CreateProductAssetDto>(); |
|||
CreateMap<EditProductAssetViewModel, UpdateProductAssetDto>(); |
|||
|
|||
CreateMap<ProductAssetPeriodDto, EditProductAssetPeriodViewModel>(); |
|||
CreateMap<CreateProductAssetPeriodViewModel, CreateProductAssetPeriodDto>(); |
|||
CreateMap<EditProductAssetPeriodViewModel, UpdateProductAssetPeriodDto>(); |
|||
|
|||
CreateMap<ProductAssetCategoryDto, EditProductAssetCategoryViewModel>(); |
|||
CreateMap<CreateProductAssetCategoryViewModel, CreateProductAssetCategoryDto>(); |
|||
CreateMap<EditProductAssetCategoryViewModel, UpdateProductAssetCategoryDto>(); |
|||
|
|||
CreateMap<ProductAssetCategoryPeriodDto, EditProductAssetCategoryPeriodViewModel>(); |
|||
CreateMap<CreateProductAssetCategoryPeriodViewModel, CreateProductAssetCategoryPeriodDto>(); |
|||
CreateMap<EditProductAssetCategoryPeriodViewModel, UpdateProductAssetCategoryPeriodDto>(); |
|||
|
|||
CreateMap<GrantedStoreDto, CreateEditGrantedStoreViewModel>(); |
|||
CreateMap<CreateEditGrantedStoreViewModel, CreateUpdateGrantedStoreDto>(); |
|||
} |
|||
} |
|||
@ -0,0 +1,125 @@ |
|||
using EasyAbp.EShop.Plugins.Booking.GrantedStores.Dtos; |
|||
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories.Dtos; |
|||
using EasyAbp.EShop.Plugins.Booking.ProductAssets.Dtos; |
|||
using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.GrantedStores.GrantedStore.ViewModels; |
|||
using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategory.ViewModels; |
|||
using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategoryPeriod.ViewModels; |
|||
using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssets.ProductAsset.ViewModels; |
|||
using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssets.ProductAssetPeriod.ViewModels; |
|||
using Riok.Mapperly.Abstractions; |
|||
using Volo.Abp.Mapperly; |
|||
|
|||
namespace EasyAbp.EShop.Plugins.Booking.Web |
|||
{ |
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class ProductAssetDtoToEditProductAssetViewModelMapper : MapperBase<ProductAssetDto, EditProductAssetViewModel> |
|||
{ |
|||
public override partial EditProductAssetViewModel Map(ProductAssetDto source); |
|||
|
|||
public override partial void Map(ProductAssetDto source, EditProductAssetViewModel destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class CreateProductAssetViewModelToCreateProductAssetDtoMapper : MapperBase<CreateProductAssetViewModel, CreateProductAssetDto> |
|||
{ |
|||
public override partial CreateProductAssetDto Map(CreateProductAssetViewModel source); |
|||
|
|||
public override partial void Map(CreateProductAssetViewModel source, CreateProductAssetDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class EditProductAssetViewModelToUpdateProductAssetDtoMapper : MapperBase<EditProductAssetViewModel, UpdateProductAssetDto> |
|||
{ |
|||
public override partial UpdateProductAssetDto Map(EditProductAssetViewModel source); |
|||
|
|||
public override partial void Map(EditProductAssetViewModel source, UpdateProductAssetDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class ProductAssetPeriodDtoToEditProductAssetPeriodViewModelMapper : MapperBase<ProductAssetPeriodDto, EditProductAssetPeriodViewModel> |
|||
{ |
|||
public override partial EditProductAssetPeriodViewModel Map(ProductAssetPeriodDto source); |
|||
|
|||
public override partial void Map(ProductAssetPeriodDto source, EditProductAssetPeriodViewModel destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class CreateProductAssetPeriodViewModelToCreateProductAssetPeriodDtoMapper : MapperBase<CreateProductAssetPeriodViewModel, CreateProductAssetPeriodDto> |
|||
{ |
|||
public override partial CreateProductAssetPeriodDto Map(CreateProductAssetPeriodViewModel source); |
|||
|
|||
public override partial void Map(CreateProductAssetPeriodViewModel source, CreateProductAssetPeriodDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class EditProductAssetPeriodViewModelToUpdateProductAssetPeriodDtoMapper : MapperBase<EditProductAssetPeriodViewModel, UpdateProductAssetPeriodDto> |
|||
{ |
|||
public override partial UpdateProductAssetPeriodDto Map(EditProductAssetPeriodViewModel source); |
|||
|
|||
public override partial void Map(EditProductAssetPeriodViewModel source, UpdateProductAssetPeriodDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class ProductAssetCategoryDtoToEditProductAssetCategoryViewModelMapper : MapperBase<ProductAssetCategoryDto, EditProductAssetCategoryViewModel> |
|||
{ |
|||
public override partial EditProductAssetCategoryViewModel Map(ProductAssetCategoryDto source); |
|||
|
|||
public override partial void Map(ProductAssetCategoryDto source, EditProductAssetCategoryViewModel destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class CreateProductAssetCategoryViewModelToCreateProductAssetCategoryDtoMapper : MapperBase<CreateProductAssetCategoryViewModel, CreateProductAssetCategoryDto> |
|||
{ |
|||
public override partial CreateProductAssetCategoryDto Map(CreateProductAssetCategoryViewModel source); |
|||
|
|||
public override partial void Map(CreateProductAssetCategoryViewModel source, CreateProductAssetCategoryDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class EditProductAssetCategoryViewModelToUpdateProductAssetCategoryDtoMapper : MapperBase<EditProductAssetCategoryViewModel, UpdateProductAssetCategoryDto> |
|||
{ |
|||
public override partial UpdateProductAssetCategoryDto Map(EditProductAssetCategoryViewModel source); |
|||
|
|||
public override partial void Map(EditProductAssetCategoryViewModel source, UpdateProductAssetCategoryDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class ProductAssetCategoryPeriodDtoToEditProductAssetCategoryPeriodViewModelMapper : MapperBase<ProductAssetCategoryPeriodDto, EditProductAssetCategoryPeriodViewModel> |
|||
{ |
|||
public override partial EditProductAssetCategoryPeriodViewModel Map(ProductAssetCategoryPeriodDto source); |
|||
|
|||
public override partial void Map(ProductAssetCategoryPeriodDto source, EditProductAssetCategoryPeriodViewModel destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class CreateProductAssetCategoryPeriodViewModelToCreateProductAssetCategoryPeriodDtoMapper : MapperBase<CreateProductAssetCategoryPeriodViewModel, CreateProductAssetCategoryPeriodDto> |
|||
{ |
|||
public override partial CreateProductAssetCategoryPeriodDto Map(CreateProductAssetCategoryPeriodViewModel source); |
|||
|
|||
public override partial void Map(CreateProductAssetCategoryPeriodViewModel source, CreateProductAssetCategoryPeriodDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class EditProductAssetCategoryPeriodViewModelToUpdateProductAssetCategoryPeriodDtoMapper : MapperBase<EditProductAssetCategoryPeriodViewModel, UpdateProductAssetCategoryPeriodDto> |
|||
{ |
|||
public override partial UpdateProductAssetCategoryPeriodDto Map(EditProductAssetCategoryPeriodViewModel source); |
|||
|
|||
public override partial void Map(EditProductAssetCategoryPeriodViewModel source, UpdateProductAssetCategoryPeriodDto destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class GrantedStoreDtoToCreateEditGrantedStoreViewModelMapper : MapperBase<GrantedStoreDto, CreateEditGrantedStoreViewModel> |
|||
{ |
|||
public override partial CreateEditGrantedStoreViewModel Map(GrantedStoreDto source); |
|||
|
|||
public override partial void Map(GrantedStoreDto source, CreateEditGrantedStoreViewModel destination); |
|||
} |
|||
|
|||
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] |
|||
public partial class CreateEditGrantedStoreViewModelToCreateUpdateGrantedStoreDtoMapper : MapperBase<CreateEditGrantedStoreViewModel, CreateUpdateGrantedStoreDto> |
|||
{ |
|||
public override partial CreateUpdateGrantedStoreDto Map(CreateEditGrantedStoreViewModel source); |
|||
|
|||
public override partial void Map(CreateEditGrantedStoreViewModel source, CreateUpdateGrantedStoreDto destination); |
|||
} |
|||
} |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue