abpframework / abpframework/abp

Introduce bulk entity events

Open
#16,107 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

abp-framework feature
Dominant language
C#
Stars
14.4k
Forks
3.7k
Avg merge
15h 32m
Merged PRs (30d)
106

Description

Is there an existing issue for this?
  • I have searched the existing issues
Is your feature request related to a problem? Please describe the problem.

consider this scenario:
you have a separate algolia search server, and you want to sync data between your database and the algolia index.

the current solution is to implement ILocalEventHandler<EntityChangedEventData<TEntity>>.
this works when only a single entity is getting changed, but not for InsertMany,UpdateMany,DeleteMany since they will introduce the N+1 problem

Describe the solution you'd like

I suggest that new events to get introduced:

  • IBulkEntityChangeEventHelper
      public interface IBulkEntityChangeEventHelper
      {
          void PublishEntityCreatedEvent(IEnumerable<object> entity);
    
          void PublishEntityUpdatedEvent(IEnumerable<object> entity);
    
          void PublishEntityDeletedEvent(IEnumerable<object> entity);
      }
    
  • BulkEntityEventData -> contains a list of entities
  • BulkEntityChangedEventData -> fired when many entities are changed
  • BulkEntityCreatedEventData -> fired when many entities are created
  • BulkEntityUpdatedEventData -> fired when many entities are updated
  • BulkEntityDeletedEventData -> fired when many entities are deleted

and then we can add a configuration for users to override the behavior of InsertMany, UpdateMany,DeleteMany to control whether the old events EntityChangedEventData are fired alongside the new bulk ones or not

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the InsertMany, UpdateMany, and DeleteMany entry points and the existing EntityChangedEventData flow. Review how the proposed IBulkEntityChangeEventHelper and bulk event data types would integrate with those operations. Done means bulk events avoid the N+1 problem and configuration clearly defines whether the existing single-entity events are also published.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.