AbpHelper.CLI icon indicating copy to clipboard operation
AbpHelper.CLI copied to clipboard

Synchronizer class generator

Open gdlcf88 opened this issue 4 years ago • 2 comments

Synchronizer Class Generator

It generates a local entity data synchronizer class on the same path with the target entity class.

Usage

Command

abphelper generate synchronizer [options] <LocalEntityName> <TargetEntityOrEtoFullName>

Options

--distributed-events

Handle the distributed events instead of local events.

--ignore-update

Do not synchronize the data when the target entity is updated.

--ignore-delete

Do not delete the local entity when the target entity is deleted.

Samples

abphelper generate synchronizer Product EasyAbp.EShop.Payments.Payment

abphelper generate synchronizer --distributed-events Product EasyAbp.EShop.Payments.Etos.PaymentEto

Generation Steps

  1. Try to create MyProjectDomainAutoMapperProfile.cs.
  2. Try to configure AbpAutoMapperOptions. (refer to the example)
  3. Add CreateMap<TTargetEntity, TEntity>(MemberList.Source); to the profile.
  4. Generate the synchronizer class. (refer to the example)

gdlcf88 avatar Jul 14 '20 20:07 gdlcf88

It is not easy to update the related entities of an aggregate root, we should ignore mapping the related entities since it will cover the original entities. (Maybe there are some better ways?)

See: https://github.com/EasyAbp/EShop/blob/dev/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/Payments/PaymentSynchronizer.cs https://github.com/EasyAbp/EShop/blob/dev/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/PaymentsDomainAutoMapperProfile.cs

gdlcf88 avatar Jul 15 '20 20:07 gdlcf88

Should ignore mapping the ConcurrencyStamp property.

gdlcf88 avatar Jul 15 '20 21:07 gdlcf88