Typically this problem can be easily prevented at least in two ways:
- The UoW has both a begin and commit method with an internal scope counter —if every service method does a begin and commit, save changes will only be invoked once when your code goes back to the initial method that started the work (my recommendation is to use aspects) — see my ScopedEnabledUnitOfWork;
- Using a mediator and commands — keeping the same scope concepts from option 1, you only need to begin before commands execution and commit on successes. For this you normally won’t need aspects since the mediators typically provide a pipeline for interceptions — see my mediator library for details;
Normally this is enough to prevent most performance issues on bulk operations.