12.2.0 (2024-11-12)
- Update
MediatR
to12.4.1
-
- Update
Autofac
to8.1.1
- Update
12.1.0 (2024-06-28)
- Update
MediatR
to12.3.0
12.0.0 (2024-01-22)
- Update
Autofac
to8.0.0
. For the list of breaking-changes, take a look at the official release
11.3.0 (2023-11-21)
- Update
MediatR
to12.2.0
11.2.0 (2023-08-28)
- Update
Autofac
to7.1.0
11.1.0 (2023-08-02)
- Update
Autofac
to7.0.1
- Update
MediatR
to11.1.1
11.0.0 (2023-03-08)
- Remove obsolete extension method to register
MediatR
. From now on you will require to usebuilder.RegisterMediatR(MediatRConfiguration)
and provide aMediatRConfiguration
usingMediatRConfigurationBuilder
. Autofac
has been updated to version7.0.0
. There are a set of breaking changes. Some of them will not have any effects on you but you will need to evaluate that. Please check out this link for more details.
- Update
Autofac
to7.0.0
- Update
MediatR
to11.0.1
10.0.0 (2023-02-17)
- Remove obsolete extension method to register
MediatR
. From now on you will require to usebuilder.RegisterMediatR(MediatRConfiguration)
and provide aMediatRConfiguration
usingMediatRConfigurationBuilder
. MediatR
has been updated to version12.0.0
. There are a set of breaking changes that you will need to fix. Please follow the migration guide for more details.
- Add support to register a custom implementation that implements all mediator interface (
IMediator
,ISender
,IPublisher
) - Add support to register a custom implementation of
INotificationPublisher
- Add support for
IRequestHandler<>
which is required forMediatR
version12.0.0
- Add
ServiceProviderWrapper
that implementsIServiceProvider
and usesILifeTimeScope
to resolve services - Add
ServiceProviderWrapper
to the container but only iftypeof(IServiceProvider)
has not been registered yet - Re-add support for
netstandard2.0
to align withMediatR
9.2.0 (2023-01-16)
- Add possibility to register
MediatR
dependencies as eitherTransient
orScoped
.Transient
translates toInstancePerDependency
whereasScoped
translates toInstancePerLifetimeScope
- All extensions method on
ContainerBuilder
have been marked as deprecated and will be removed with version10.0.0
. Please usebuilder.RegisterMediatR(MediatRConfiguration)
9.1.0 (2022-11-23)
- Update
MediatR
to version11.0.0
- Update
Autofac
to version6.5.0
9.0.0 (2022-09-30)
- Update
MediatR
to version11.0.0
- There is a small breaking-change regarding the order of parameters in classes that implement
IPipelineBehavior<TRequest, TResponse>
. Please see the release-notes of MediatR for more details.
8.2.0 (2022-09-07)
- Expose
MediatRConfiguration
andMediatRConfigurationBuilder
as a new way to build theMediatR
configuration - Add new extension that takes an instance of
MediatRConfiguration
as a parameter - Allow automatic registration to be disabled using
MediatRConfiguration
. Closes #10
8.1.0 (2022-05-31)
- Update
Autofac
to6.4.0
8.0.1 (2022-01-30)
- Update
MediatR
to10.0.1
8.0.0 (2022-01-09)
MediatR
version 10.0.0 dropped support fornetstandard2.0
. From now own onlynetstandard2.1
is supported- Previously marked obsolete methods
AddMediatR
have been removed
- Add support for
IStreamRequestHandler<,>
andIStreamRequestPipelineBehavior<,>
7.4.0 (2021-11-12)
- Update
Autofac
to6.3.0
7.3.0 (2021-06-21)
- Register types
IRequestPreProcessor<>
andIRequestPostProcessor<,>
of provided assembly. Implements #7
7.2.0 (2021-04-23)
- Upgrade
Autofac
to version6.2.0
7.1.0 (2021-01-09)
- Upgrade
Autofac
to version6.1.0
- Add dedicated TFM for
netstandard2.1
- Make sure release-notes URL is correctly set in package meta-data.
7.0.0 (2020-10-08)
MediatR
has been updated to version9.0.0
. This release contains minor breaking changes. Check out the blog-post for more details.
6.0.0 (2020-09-29)
Autofac
has been updated to version6.0.0
. This release contains many new features but also breaking-changes. Check out this blog-post for more information.
AddMediatR
has been marked as deprecated and will be removed with version7.0.0
.
- New extensions were added that are more aligned with the
Autofac
syntax for registering dependencies. Please useRegisterMediatR
instead ofAddMediatR
5.3.0 (2020-08-02)
- Update
MediatR
to version8.1.0
5.2.1 (2020-07-03)
- Update
MediatR
to version8.0.2
. This enables nullable features of C#8
5.2.0 (2020-06-11)
- Update
Autofac
to version5.2.0
5.1.0 (2020-02-22)
- Update
Autofac
to version5.1.1
- Update sample project dependencies
5.0.0 (2020-01-29)
Autofac
has been updated to5.0.0
. The release ofAutofac
contains breaking changes, mostly making the container immutable. You can read more about the changes here.
4.0.0 (2020-01-01)
MediatR
has been updated to8.0.0
. This major release contains small breaking changes. Check out this post for more information.- Open types were previously registered with implementing interfaces which can cause handlers two be called twice when a class implements
IRequestHandler<,>
andINotificationHandler<>
. To prevent this from happening,.AsImplementedInterfaces()
has been removed from the registration. If you wish to register it like before, use this code after calling the extension methodAddMediatR
.
var openHandlerTypes = new[]
{
typeof(IRequestHandler<,>),
typeof(IRequestExceptionHandler<,,>),
typeof(IRequestExceptionAction<,>),
typeof(INotificationHandler<>),
};
foreach (var openHandlerType in openHandlerTypes)
{
builder.RegisterAssemblyTypes(this.assemblies)
.AsClosedTypesOf(openHandlerType)
.AsImplementedInterfaces();
}
- Two extensions that were likely not used have been removed from
ContainerBuilderExtensions
.
- Support for
MediatR
version8.0.0
by registering the new behaviors and open-handlers for handling exceptions. Check out this post for more information.
3.1.1 (2019-12-26)
- Make sure that
MediatRModule
does not throw when no custom types are passed into the extension methods, fixes #4
3.1.0 (2019-12-14)
- It is now possible to pass in behaviors that implement
IPipelineBehavior<TRequest, TResponse>
.
public LoggingBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse>
{
private readonly ILogger<LoggingBehavior<TRequest, TResponse>> _logger;
public LoggingBehavior(ILogger<LoggingBehavior<TRequest, TResponse>> logger)
{
_logger = logger;
}
public Task<TResponse> Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate<TResponse> next)
{
_logger.LogInformation("Got request at {requestTime} and content", DateTime.UtcNow().ToString("O"), JsonConvert.SerializeObject(request));
return next();
}
}
public CachingBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse>
{
private readonly ILogger<CachingBehavior<TRequest, TResponse>> _logger;
private readonly ICache _cache;
public CachingBehavior(ILogger<CachingBehavior<TRequest, TResponse>> logger, ICache cache)
{
_logger = logger;
_cache = cache;
}
public async Task<TResponse> Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate<TResponse> next)
{
var key = GenerateKeyFromRequest(request);
_cache.TryGetValue(key, out var cachedResponse)
{
_logger.LogInformation("{key} found in cache, using cached-value", key);
return await cachedResponse;
}
var response = next();
_cache.Set(key, response);
return await response;
}
}
We would register MediatR
like that
var containerBuilder = new ContainerBuilder();
// Since there are two default behaviors the execution order would now be the following
// 1. LoggingBehavior<TRequest, TResponse>
// 2. CachingBehavior<TRequest, TResponse>
// 3. RequestPreProcessorBehavior<TRequest, TResponse>
// 4. RequestPostProcessorBehavior<TRequest, TResponse>
containerBuilder.RegisterMediatR(typeof(SomeClassThatIsInSameAssemblyAsMediatRTypes).Assembly,
typeof(CachingBehavior<,>), typeof(LoggingBehavior<,>));
public LoggingBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse>
{
private readonly ILogger<LoggingBehavior<TRequest, TResponse>> _logger;
public LoggingBehavior(ILogger<LoggingBehavior<TRequest, TResponse>> logger)
{
_logger = logger;
}
public Task<TResponse> Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate<TResponse> next)
{
_logger.LogInformation("Got request at {requestTime} and content", DateTime.UtcNow().ToString("O"), JsonConvert.SerializeObject(request));
return next();
}
}
public CachingBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse> where TRequest : class, ICacheableRequest<TResponse>
{
private readonly ILogger<CachingBehavior<TRequest, TResponse>> _logger;
private readonly ICache _cache;
public CachingBehavior(ILogger<CachingBehavior<TRequest, TResponse>> logger, ICache cache)
{
_logger = logger;
_cache = cache;
}
public async Task<TResponse> Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate<TResponse> next)
{
var key = GenerateKeyFromRequest(request);
_cache.TryGetValue(key, out var cachedResponse)
{
_logger.LogInformation("{key} found in cache, using cached-value", key);
return await cachedResponse;
}
var response = next();
_cache.Set(key, response);
return await response;
}
}
We would register MediatR
like that again
var containerBuilder = new ContainerBuilder();
// Since there are two default behaviors, two custom behaviors and one with a constraint, the execution order would now be the following
// 1. CachingBehavior<TRequest, TResponse>
// 2. LoggingBehavior<TRequest, TResponse>
// 3. RequestPreProcessorBehavior<TRequest, TResponse>
// 4. RequestPostProcessorBehavior<TRequest, TResponse>
containerBuilder.RegisterMediatR(typeof(SomeClassThatIsInSameAssemblyAsMediatRTypes).Assembly,
typeof(CachingBehavior<,>), typeof(LoggingBehavior<,>));
For more specifics please checkout the tests
3.0.1 (2019-08-20)
- Update Autofac to version 4.9.4
3.0.0 (2019-05-05)
- Update MediatR to version 7.0.0. Please see the changelog of MediatR since it contains breaking-changes for the request post-processors.
2.1.0 (2019-03-29)
- Update Autofac to version 4.9.2
2.1.0 (2019-03-17)
- Update Autofac to version 4.9.1
- Update Autofac.Extensions.DependencyInjection 4.4.0
- Adjust copyright
2.0.1 (2019-01-25)
- Support older .NET-Framework versions by using
typeof(T).GetTypeInfo().Assembly
rather thantypeof(T).Assembly
. Closes #1
2.0.0 (2018-12-11)
- Update to MediatR 6.0.0
- Update Autofac.Extensions.DependencyInjection 4.3.0
- The latest implementation might contain breaking changes, if you did overrider MediatR's default behaviours. For more information please checkout the release-notes
1.2.1 (2018-08-11)
- Adjust package-infos
1.2.0 (2018-07-30)
- Update MediatR to 5.1.0
1.1.0 (2018-07-14)
- Allow chaining of method-calls
1.0.1 (2018-07-08)
- update project file
1.0.0 (2018-07-07)
- Allow MediatR and it's components to be registered via an extension method for Autofac.