Open Closed

Auto-insert of specific entity table rows when a feature is added to tenant #7672


0
TECSIS created

Hi, I need to ensure that for some (IMustHaveTenant, IFullAudited) entities, when a specific Feature is granted, than a certain set of table rows (identified by natural key values) exists, i.e. is inserted if not existing or undeleted if soft deleted.

This logic must occours in both cases: when that Feaure is directly added to tenants and when an Edition including that Feature is applyed to tenants. Obviously the record set must be soft deleted when that Feature is removed from Tenant/Edition, Edition is deleted,...

Normally I would override some entity's Manager methods, concatenating base method logic with my custom one, in a [UnitOfWork] context, but here we have two different entities involved and I can't find a common base entry point to customize, so I'm asking:

  1. am I looking in the right direction to achieve my needs, or there is a better way to implement custom logic on Feature assignement?
  2. if I am right (customize at Domain Service level), which approach should I follow, event-based or non event-based? a. Hide/override TenantManager's HandleEvent* and implementing variousIEventHandler in EditionManager? b. Override TenantManager's SetFeatureValueAsync, UpdateAsync (for Edition change) and DeleteAsync, plus EditionManager's SetFeatureValuesAsync and DeleteAsync?

Thanks for any advice Cheers


2 Answer(s)