Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented missing methods in the SaveChangesInterceptorAggregator #31363

Merged

Conversation

matheus-inacio
Copy link
Contributor

Closes #31361

Description

When more then one interceptor is registered for a DBContext, the AggregateInterceptors method from the InterceptorAggregator class, creates an InterceptorAggregator by calling CreateChain.

else if (interceptors.Count > 1)
{
var filtered = interceptors.OfType<TInterceptor>().ToList();
if (filtered.Count == 1)
{
_interceptor = filtered[0];
}
else if (filtered.Count > 1)
{
_interceptor = CreateChain(filtered);

Then when triggering the interceptor, the SaveChangesInterceptorAggregator is triggered.

if (interceptor != null)
{
return interceptor.ThrowingConcurrencyException(eventData, default);
}

Since SaveChangesInterceptorAggregator does not implement the methods ThrowingConcurrencyException and ThrowingConcurrencyExceptionAsync from the ISaveChangesInterceptor, therefore no interceptor in the aggregator is notified.

@matheus-inacio matheus-inacio changed the title Implemented missing methods from the ISaveChangesInterceptor interface. Implemented missing methods in the SaveChangesInterceptorAggregator Jul 27, 2023
@ajcvickers ajcvickers merged commit a217f73 into dotnet:main Jul 27, 2023
6 of 7 checks passed
@ajcvickers
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ThrowingConcurrencyException not triggering with multiple interceptors registered
2 participants