EasyAbp / AbpHelper.CLI

Providing code generation and more features to help you develop applications and modules with the ABP framework.
MIT License
285 stars 95 forks source link

Synchronizer class generator #88

Open gdlcf88 opened 4 years ago

gdlcf88 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

Should ignore mapping the ConcurrencyStamp property.