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

Bump MediatR from 11.1.0 to 12.0.1 #138

Merged
merged 3 commits into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<PackageVersion Include="Ardalis.GuardClauses" Version="4.0.1" />
<PackageVersion Include="Ardalis.Specification.EntityFrameworkCore" Version="6.1.0" />
<PackageVersion Include="Scrutor" Version="4.2.1" />
<PackageVersion Include="MediatR" Version="11.1.0" />
<PackageVersion Include="MediatR" Version="12.0.1" />
<PackageVersion Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="11.0.0" />
<PackageVersion Include="MassTransit" Version="8.0.9" />
<PackageVersion Include="MassTransit.AspNetCore" Version="7.3.1" />
Expand Down
4 changes: 3 additions & 1 deletion src/NKZSoft.Template.Application/DependencyInjection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ public static class DependencyInjection
public static IServiceCollection AddApplication(this IServiceCollection services)
{
services.AddValidatorsFromAssembly(Assembly.GetExecutingAssembly(), ServiceLifetime.Scoped, null, true);
services.AddMediatR(Assembly.GetExecutingAssembly());
services.AddMediatR(cfg =>
cfg.RegisterServicesFromAssemblies(Assembly.GetExecutingAssembly()));


var typeAdapterConfig = TypeAdapterConfig.GlobalSettings;
typeAdapterConfig.Scan(Assembly.GetExecutingAssembly());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public sealed class DeleteTodoItemCommandHandler : IRequestHandler<DeleteTodoIte

public DeleteTodoItemCommandHandler(IToDoItemRepository repository) => _repository = repository;

public async Task<Unit> Handle(DeleteTodoItemCommand request, CancellationToken cancellationToken)
public async Task Handle(DeleteTodoItemCommand request, CancellationToken cancellationToken)
{
var entity = await _repository
.SingleOrDefaultAsync(new ToDoItemByIdSpecification(request.Id), cancellationToken)
Expand All @@ -23,7 +23,5 @@ public async Task<Unit> Handle(DeleteTodoItemCommand request, CancellationToken
await _repository.DeleteAsync(entity, cancellationToken).ConfigureAwait(false);
await _repository.SaveChangesAsync(cancellationToken)
.ConfigureAwait(false);

return Unit.Value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public sealed class UpdateTodoItemCommandHandler : IRequestHandler<UpdateTodoIte

public UpdateTodoItemCommandHandler(IToDoItemRepository repository) => _repository = repository.ThrowIfNull();

public async Task<Unit> Handle(UpdateTodoItemCommand request, CancellationToken cancellationToken)
public async Task Handle(UpdateTodoItemCommand request, CancellationToken cancellationToken)
{
var entity = await _repository
.SingleOrDefaultAsync(new ToDoItemByIdSpecification(request.Id), cancellationToken)
Expand All @@ -24,7 +24,5 @@ public async Task<Unit> Handle(UpdateTodoItemCommand request, CancellationToken

await _repository.SaveChangesAsync(cancellationToken)
.ConfigureAwait(false);

return Unit.Value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public static IServiceCollection AddNgpSqlPersistence(this IServiceCollection se
.AsMatchingInterface()
.WithScopedLifetime());

services.AddMediatR(Assembly.GetExecutingAssembly());
services.AddMediatR(cfg =>
cfg.RegisterServicesFromAssemblies(Assembly.GetExecutingAssembly()));

return services;
}
Expand Down