Skip to content

Commit

Permalink
Got rid of MediatR in QueryBus
Browse files Browse the repository at this point in the history
  • Loading branch information
oskardudycz committed Nov 26, 2022
1 parent cc04cd0 commit d804a00
Show file tree
Hide file tree
Showing 56 changed files with 154 additions and 1,097 deletions.
28 changes: 0 additions & 28 deletions CQRS.Tests/CQRS.Tests.csproj

This file was deleted.

120 changes: 0 additions & 120 deletions CQRS.Tests/Commands/Commands.cs

This file was deleted.

121 changes: 0 additions & 121 deletions CQRS.Tests/Queries/Queries.cs

This file was deleted.

38 changes: 0 additions & 38 deletions CQRS.Tests/TestsInfrasructure/ServiceLocator.cs

This file was deleted.

3 changes: 1 addition & 2 deletions Core/Commands/Config.cs
@@ -1,5 +1,4 @@
using MediatR;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;

namespace Core.Commands;

Expand Down
5 changes: 0 additions & 5 deletions Core/Commands/Mediator/ICommand.cs

This file was deleted.

6 changes: 0 additions & 6 deletions Core/Commands/Mediator/IMediatorCommandBus.cs

This file was deleted.

8 changes: 0 additions & 8 deletions Core/Commands/Mediator/IMediatorCommandHandler.cs

This file was deleted.

18 changes: 0 additions & 18 deletions Core/Commands/Mediator/MediatorCommandBus.cs

This file was deleted.

14 changes: 2 additions & 12 deletions Core/Config.cs
Expand Up @@ -4,7 +4,6 @@
using Core.OpenTelemetry;
using Core.Queries;
using Core.Requests;
using MediatR;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;

Expand All @@ -14,25 +13,16 @@ public static class Config
{
public static IServiceCollection AddCoreServices(this IServiceCollection services)
{
// TODO: Remove MediatR
services
.AddSingleton<IActivityScope, ActivityScope>()
.AddMediatR()
.AddScoped<IQueryBus, QueryBus>()
.AddEventBus()
.AddCommandBus();
.AddCommandBus()
.AddQueryBus();

services.TryAddScoped<IExternalCommandBus, ExternalCommandBus>();

services.TryAddScoped<IIdGenerator, NulloIdGenerator>();

return services;
}

private static IServiceCollection AddMediatR(this IServiceCollection services)
{
return services
.AddScoped<IMediator, Mediator>()
.AddTransient<ServiceFactory>(sp => sp.GetRequiredService!);
}
}

0 comments on commit d804a00

Please sign in to comment.