Skip to content

v10.2.0

Choose a tag to compare

@pdeffendol pdeffendol released this 07 Dec 15:17
· 50 commits to main since this release

What's Changed

Added an EF Core interceptor for dispatching events by @pdeffendol in #60

This should replace manual setup of domain event dispatching in your DbContext. Add the interceptor when registering your application's services:

// ...
builder.Services
    .AddMediatR(configuration => configuration.RegisterServicesFromAssemblyContaining<Program>())
    .AddSingleton<IDomainEventDispatcher, MediatRDomainEventDispatcher>();
// ...
builder.Services.AddSingleton<DispatchDomainEventsInterceptor>();
builder.Services.AddDbContext<ApplicationDbContext>((sp, options) =>
{
    options.AddInterceptors(sp.GetRequiredService<DispatchDomainEventsInterceptor>());
    options.UseSqlServer(connectionString);
});
// ...

Full Changelog: v10.1.0...v10.2.0