diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 01de3b6..e1e85d2 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -51,10 +51,14 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') run: echo "version=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT" - - name: Pack project + - name: Pack DispatchR project if: startsWith(github.ref, 'refs/tags/v') run: dotnet pack src/DispatchR/DispatchR.csproj --configuration Release --no-build -o ./nupkgs /p:PackageVersion=${{ steps.get_version.outputs.version }} + - name: Pack DispatchR Abstractions project + if: startsWith(github.ref, 'refs/tags/v') + run: dotnet pack src/DispatchR.Abstractions/DispatchR.Abstractions.csproj --configuration Release --no-build -o ./nupkgs /p:PackageVersion=${{ steps.get_version.outputs.version }} + - name: Push to NuGet if: startsWith(github.ref, 'refs/tags/v') run: dotnet nuget push "./nupkgs/*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json \ No newline at end of file diff --git a/DispatchR.sln b/DispatchR.sln index ff93c34..d08ec5b 100644 --- a/DispatchR.sln +++ b/DispatchR.sln @@ -43,6 +43,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DispatchR.IntegrationTest", EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DispatchR.TestCommon", "tests\DispatchR.TestCommon\DispatchR.TestCommon.csproj", "{F01B6563-64D0-4316-947C-AB75426D9924}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DispatchR.Abstractions", "src\DispatchR.Abstractions\DispatchR.Abstractions.csproj", "{27CFB785-B631-4044-AA90-4B21FA908C0A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -173,6 +175,18 @@ Global {F01B6563-64D0-4316-947C-AB75426D9924}.Release|x64.Build.0 = Release|Any CPU {F01B6563-64D0-4316-947C-AB75426D9924}.Release|x86.ActiveCfg = Release|Any CPU {F01B6563-64D0-4316-947C-AB75426D9924}.Release|x86.Build.0 = Release|Any CPU + {27CFB785-B631-4044-AA90-4B21FA908C0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {27CFB785-B631-4044-AA90-4B21FA908C0A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {27CFB785-B631-4044-AA90-4B21FA908C0A}.Debug|x64.ActiveCfg = Debug|Any CPU + {27CFB785-B631-4044-AA90-4B21FA908C0A}.Debug|x64.Build.0 = Debug|Any CPU + {27CFB785-B631-4044-AA90-4B21FA908C0A}.Debug|x86.ActiveCfg = Debug|Any CPU + {27CFB785-B631-4044-AA90-4B21FA908C0A}.Debug|x86.Build.0 = Debug|Any CPU + {27CFB785-B631-4044-AA90-4B21FA908C0A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {27CFB785-B631-4044-AA90-4B21FA908C0A}.Release|Any CPU.Build.0 = Release|Any CPU + {27CFB785-B631-4044-AA90-4B21FA908C0A}.Release|x64.ActiveCfg = Release|Any CPU + {27CFB785-B631-4044-AA90-4B21FA908C0A}.Release|x64.Build.0 = Release|Any CPU + {27CFB785-B631-4044-AA90-4B21FA908C0A}.Release|x86.ActiveCfg = Release|Any CPU + {27CFB785-B631-4044-AA90-4B21FA908C0A}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -191,5 +205,6 @@ Global {806030F5-86B1-4EFC-923C-94FF7D32DFC9} = {7F7601D5-C62E-4EA3-8B71-E946A62B4529} {D8646A62-9FE7-4E79-861C-49391007F98A} = {7F7601D5-C62E-4EA3-8B71-E946A62B4529} {F01B6563-64D0-4316-947C-AB75426D9924} = {7F7601D5-C62E-4EA3-8B71-E946A62B4529} + {27CFB785-B631-4044-AA90-4B21FA908C0A} = {89F559F6-C217-4D24-9A2F-DF25AE215A7C} EndGlobalSection EndGlobal diff --git a/README.md b/README.md index dfdfbcc..6e9dd52 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# DispatchR 🚀 +# ispatchR 🚀 ![CI](https://github.com/hasanxdev/DispatchR/workflows/Release/badge.svg) [![codecov](https://codecov.io/github/hasanxdev/dispatchr/graph/badge.svg?token=1FUG5DPUOE)](https://codecov.io/github/hasanxdev/dispatchr) @@ -33,6 +33,15 @@ 2. `INotificationHandler` > :bulb: **Tip:** *If you're looking for a mediator with the raw performance of hand-written code, DispatchR is built for you.* +## ✨ How to install? +``` +dotnet add package DispatchR.Mediator +``` +You can also separately add only the abstractions, which include the interfaces, in another layer: +``` +dotnet add package DispatchR.Mediator.Abstractions +``` + # Syntax Comparison: DispatchR vs MediatR ###### In the following, you will see the key differences and implementation details between MediatR and DispatchR. @@ -369,11 +378,6 @@ builder.Services.AddScoped, EventHandler>(); 2. Manual registration allows for custom pipeline or notification ordering 3. You can implement custom reflection if needed -## ✨ How to install? -``` -dotnet add package DispatchR.Mediator -``` - # 🧪 Bechmark Result: > [!IMPORTANT] > This benchmark was conducted using MediatR version 12.5.0 and the stable release of Mediator Source Generator, version 2.1.7. diff --git a/icon-mini.png b/icon-mini.png new file mode 100644 index 0000000..4353531 Binary files /dev/null and b/icon-mini.png differ diff --git a/icon.jpg b/icon.jpg new file mode 100644 index 0000000..8cbc0dd Binary files /dev/null and b/icon.jpg differ diff --git a/src/AspireModularExample/AspireModularSample.Modules/Ping.cs b/src/AspireModularExample/AspireModularSample.Modules/Ping.cs index e7c6beb..ed74291 100644 --- a/src/AspireModularExample/AspireModularSample.Modules/Ping.cs +++ b/src/AspireModularExample/AspireModularSample.Modules/Ping.cs @@ -1,4 +1,4 @@ -using DispatchR.Requests.Send; +using DispatchR.Abstractions.Send; namespace AspireModularSample.Modules { diff --git a/src/AspireModularExample/AspireModularSample.Modules/Pong.cs b/src/AspireModularExample/AspireModularSample.Modules/Pong.cs index d7c3c3f..33c1e89 100644 --- a/src/AspireModularExample/AspireModularSample.Modules/Pong.cs +++ b/src/AspireModularExample/AspireModularSample.Modules/Pong.cs @@ -1,4 +1,4 @@ -using DispatchR.Requests.Send; +using DispatchR.Abstractions.Send; namespace AspireModularSample.Modules { diff --git a/src/AspireModularExample/AspireModularSample.ServiceA/Program.cs b/src/AspireModularExample/AspireModularSample.ServiceA/Program.cs index 7c02a4e..f0d3de4 100644 --- a/src/AspireModularExample/AspireModularSample.ServiceA/Program.cs +++ b/src/AspireModularExample/AspireModularSample.ServiceA/Program.cs @@ -1,8 +1,7 @@ using System.Reflection; using AspireModularSample.Modules; +using DispatchR; using DispatchR.Extensions; -using DispatchR.Requests; -using DispatchR.Requests.Send; var builder = WebApplication.CreateBuilder(args); diff --git a/src/AspireModularExample/AspireModularSample.ServiceB/Program.cs b/src/AspireModularExample/AspireModularSample.ServiceB/Program.cs index abfb093..635ad4a 100644 --- a/src/AspireModularExample/AspireModularSample.ServiceB/Program.cs +++ b/src/AspireModularExample/AspireModularSample.ServiceB/Program.cs @@ -1,7 +1,7 @@ using System.Reflection; using AspireModularSample.Modules; +using DispatchR; using DispatchR.Extensions; -using DispatchR.Requests; var builder = WebApplication.CreateBuilder(args); diff --git a/src/Benchmark/Notification/MultiHandlers/MultiHandler0.cs b/src/Benchmark/Notification/MultiHandlers/MultiHandler0.cs index a342b0d..a6c8b07 100644 --- a/src/Benchmark/Notification/MultiHandlers/MultiHandler0.cs +++ b/src/Benchmark/Notification/MultiHandlers/MultiHandler0.cs @@ -5,7 +5,7 @@ namespace Benchmark.Notification.MultiHandlers; public sealed class MultiHandler0 : INotificationHandler, MediatR.INotificationHandler, - DispatchR.Requests.Notification.INotificationHandler + DispatchR.Abstractions.Notification.INotificationHandler { public ValueTask Handle(MultiHandlersNotification notification, CancellationToken cancellationToken) => default; diff --git a/src/Benchmark/Notification/MultiHandlers/MultiHandler1.cs b/src/Benchmark/Notification/MultiHandlers/MultiHandler1.cs index 3b5eb17..e50aab2 100644 --- a/src/Benchmark/Notification/MultiHandlers/MultiHandler1.cs +++ b/src/Benchmark/Notification/MultiHandlers/MultiHandler1.cs @@ -5,7 +5,7 @@ namespace Benchmark.Notification.MultiHandlers; public sealed class MultiHandler1 : INotificationHandler, MediatR.INotificationHandler, - DispatchR.Requests.Notification.INotificationHandler + DispatchR.Abstractions.Notification.INotificationHandler { public ValueTask Handle(MultiHandlersNotification notification, CancellationToken cancellationToken) => default; diff --git a/src/Benchmark/Notification/MultiHandlers/MultiHandler2.cs b/src/Benchmark/Notification/MultiHandlers/MultiHandler2.cs index 2750109..716280c 100644 --- a/src/Benchmark/Notification/MultiHandlers/MultiHandler2.cs +++ b/src/Benchmark/Notification/MultiHandlers/MultiHandler2.cs @@ -5,7 +5,7 @@ namespace Benchmark.Notification.MultiHandlers; public sealed class MultiHandler2 : INotificationHandler, MediatR.INotificationHandler, - DispatchR.Requests.Notification.INotificationHandler + DispatchR.Abstractions.Notification.INotificationHandler { public ValueTask Handle(MultiHandlersNotification notification, CancellationToken cancellationToken) => default; diff --git a/src/Benchmark/Notification/MultiHandlers/MultiHandlersNotification.cs b/src/Benchmark/Notification/MultiHandlers/MultiHandlersNotification.cs index 6da5613..b528eb9 100644 --- a/src/Benchmark/Notification/MultiHandlers/MultiHandlersNotification.cs +++ b/src/Benchmark/Notification/MultiHandlers/MultiHandlersNotification.cs @@ -3,4 +3,4 @@ namespace Benchmark.Notification.MultiHandlers; public sealed record MultiHandlersNotification(Guid Id) : INotification, MediatR.INotification, - DispatchR.Requests.Notification.INotification; \ No newline at end of file + DispatchR.Abstractions.Notification.INotification; \ No newline at end of file diff --git a/src/Benchmark/Notification/MultiHandlersAsync/MultiHandlerAsync0.cs b/src/Benchmark/Notification/MultiHandlersAsync/MultiHandlerAsync0.cs index d389303..b152d50 100644 --- a/src/Benchmark/Notification/MultiHandlersAsync/MultiHandlerAsync0.cs +++ b/src/Benchmark/Notification/MultiHandlersAsync/MultiHandlerAsync0.cs @@ -5,7 +5,7 @@ namespace Benchmark.Notification.MultiHandlersAsync; public sealed class MultiHandlerAsync0 : INotificationHandler, MediatR.INotificationHandler, - DispatchR.Requests.Notification.INotificationHandler + DispatchR.Abstractions.Notification.INotificationHandler { public async ValueTask Handle(MultiHandlersAsyncNotification notification, CancellationToken cancellationToken) => await Task.Yield(); diff --git a/src/Benchmark/Notification/MultiHandlersAsync/MultiHandlerAsync1.cs b/src/Benchmark/Notification/MultiHandlersAsync/MultiHandlerAsync1.cs index d5aa479..547a17b 100644 --- a/src/Benchmark/Notification/MultiHandlersAsync/MultiHandlerAsync1.cs +++ b/src/Benchmark/Notification/MultiHandlersAsync/MultiHandlerAsync1.cs @@ -5,7 +5,7 @@ namespace Benchmark.Notification.MultiHandlersAsync; public sealed class MultiHandlerAsync1 : INotificationHandler, MediatR.INotificationHandler, - DispatchR.Requests.Notification.INotificationHandler + DispatchR.Abstractions.Notification.INotificationHandler { public async ValueTask Handle(MultiHandlersAsyncNotification notification, CancellationToken cancellationToken) => await Task.Yield(); diff --git a/src/Benchmark/Notification/MultiHandlersAsync/MultiHandlerAsync2.cs b/src/Benchmark/Notification/MultiHandlersAsync/MultiHandlerAsync2.cs index 20730cc..0176c6f 100644 --- a/src/Benchmark/Notification/MultiHandlersAsync/MultiHandlerAsync2.cs +++ b/src/Benchmark/Notification/MultiHandlersAsync/MultiHandlerAsync2.cs @@ -5,7 +5,7 @@ namespace Benchmark.Notification.MultiHandlersAsync; public sealed class MultiHandlerAsync2 : INotificationHandler, MediatR.INotificationHandler, - DispatchR.Requests.Notification.INotificationHandler + DispatchR.Abstractions.Notification.INotificationHandler { public async ValueTask Handle(MultiHandlersAsyncNotification notification, CancellationToken cancellationToken) => await Task.Yield(); diff --git a/src/Benchmark/Notification/MultiHandlersAsync/MultiHandlersAsyncNotification.cs b/src/Benchmark/Notification/MultiHandlersAsync/MultiHandlersAsyncNotification.cs index 8d9a5cd..33106d1 100644 --- a/src/Benchmark/Notification/MultiHandlersAsync/MultiHandlersAsyncNotification.cs +++ b/src/Benchmark/Notification/MultiHandlersAsync/MultiHandlersAsyncNotification.cs @@ -3,4 +3,4 @@ namespace Benchmark.Notification.MultiHandlersAsync; public sealed record MultiHandlersAsyncNotification(Guid Id) : INotification, MediatR.INotification, - DispatchR.Requests.Notification.INotification; \ No newline at end of file + DispatchR.Abstractions.Notification.INotification; \ No newline at end of file diff --git a/src/Benchmark/Notification/NotificationBenchmarks.cs b/src/Benchmark/Notification/NotificationBenchmarks.cs index 570b35e..c429d8d 100644 --- a/src/Benchmark/Notification/NotificationBenchmarks.cs +++ b/src/Benchmark/Notification/NotificationBenchmarks.cs @@ -15,7 +15,7 @@ public class NotificationBenchmarks private IServiceProvider _serviceProvider; private IServiceScope _serviceScope; private Mediator.IMediator _mediator; - private DispatchR.Requests.IMediator _dispatchR; + private DispatchR.IMediator _dispatchR; private Mediator.Mediator _concreteMediator; private MediatR.IMediator _mediatr; private SingleHandler.SingleHandler _singleHandler; @@ -59,7 +59,7 @@ public void Setup() _serviceProvider = _serviceScope.ServiceProvider; _mediator = _serviceProvider.GetRequiredService(); - _dispatchR = _serviceProvider.GetRequiredService(); + _dispatchR = _serviceProvider.GetRequiredService(); _concreteMediator = _serviceProvider.GetRequiredService(); _mediatr = _serviceProvider.GetRequiredService(); diff --git a/src/Benchmark/Notification/SingleHandler/SingleHandler.cs b/src/Benchmark/Notification/SingleHandler/SingleHandler.cs index 08a80a3..2427c45 100644 --- a/src/Benchmark/Notification/SingleHandler/SingleHandler.cs +++ b/src/Benchmark/Notification/SingleHandler/SingleHandler.cs @@ -5,7 +5,7 @@ namespace Benchmark.Notification.SingleHandler; public sealed class SingleHandler : INotificationHandler, MediatR.INotificationHandler, - DispatchR.Requests.Notification.INotificationHandler + DispatchR.Abstractions.Notification.INotificationHandler { public ValueTask Handle(SingleHandlerNotification notification, CancellationToken cancellationToken) => default; diff --git a/src/Benchmark/Notification/SingleHandler/SingleHandlerNotification.cs b/src/Benchmark/Notification/SingleHandler/SingleHandlerNotification.cs index c1890a9..5dfa3db 100644 --- a/src/Benchmark/Notification/SingleHandler/SingleHandlerNotification.cs +++ b/src/Benchmark/Notification/SingleHandler/SingleHandlerNotification.cs @@ -3,4 +3,4 @@ namespace Benchmark.Notification.SingleHandler; public sealed record SingleHandlerNotification(Guid Id) : INotification, MediatR.INotification, - DispatchR.Requests.Notification.INotification; \ No newline at end of file + DispatchR.Abstractions.Notification.INotification; \ No newline at end of file diff --git a/src/Benchmark/SendRequest/DispatchRCommands.cs b/src/Benchmark/SendRequest/DispatchRCommands.cs index 09df060..4dbd255 100644 --- a/src/Benchmark/SendRequest/DispatchRCommands.cs +++ b/src/Benchmark/SendRequest/DispatchRCommands.cs @@ -1,5 +1,4 @@ -using DispatchR.Requests; -using DispatchR.Requests.Send; +using DispatchR.Abstractions.Send; namespace Benchmark.SendRequest; diff --git a/src/Benchmark/SendRequest/MediatRVsDispatchRBenchmark.cs b/src/Benchmark/SendRequest/MediatRVsDispatchRBenchmark.cs index e0c3969..128d313 100644 --- a/src/Benchmark/SendRequest/MediatRVsDispatchRBenchmark.cs +++ b/src/Benchmark/SendRequest/MediatRVsDispatchRBenchmark.cs @@ -14,7 +14,7 @@ public class MediatRVsDispatchBenchmark private IServiceScope _serviceScopeForMediatRWithoutPipeline; private IServiceScope _serviceScopeForMediatSgWithoutPipeline; private IServiceScope _serviceScopeForDispatchRWithoutPipeline; - private DispatchR.Requests.IMediator _dispatchRWithoutPipeline; + private DispatchR.IMediator _dispatchRWithoutPipeline; private IMediator _mediatRWithoutPipeline; private Mediator.IMediator _mediatSgWithoutPipeline; private static readonly PingDispatchR StaticDispatchR = new(); @@ -42,7 +42,7 @@ public void Setup() }); withoutPipelineServices.AddDispatchR(typeof(PingDispatchR).Assembly, withPipelines: false); var buildServicesWithoutPipeline = withoutPipelineServices.BuildServiceProvider(); - _dispatchRWithoutPipeline = buildServicesWithoutPipeline.CreateScope().ServiceProvider.GetRequiredService(); + _dispatchRWithoutPipeline = buildServicesWithoutPipeline.CreateScope().ServiceProvider.GetRequiredService(); _mediatRWithoutPipeline = buildServicesWithoutPipeline.CreateScope().ServiceProvider.GetRequiredService(); _mediatSgWithoutPipeline = buildServicesWithoutPipeline.CreateScope().ServiceProvider.GetRequiredService(); _serviceScopeForMediatRWithoutPipeline = buildServicesWithoutPipeline.CreateScope(); @@ -167,7 +167,7 @@ public ValueTask DispatchR_SendRequest_With_ExistRequest_GetMediator() { return _serviceScopeForDispatchRWithoutPipeline .ServiceProvider - .GetRequiredService() + .GetRequiredService() .Send(StaticDispatchR, CancellationToken.None); } @@ -247,7 +247,7 @@ public async Task DispatchR_SendRequest_With_ExistRequest_GetMediator_Exist var result = 0; await Parallel.ForEachAsync(ScopesForDispatchRWithoutPipeline, async (scope, ct) => { - result = await scope.ServiceProvider.GetRequiredService() + result = await scope.ServiceProvider.GetRequiredService() .Send(StaticDispatchR, CancellationToken.None); }); diff --git a/src/Benchmark/SendRequest/MediatRVsDispatchRWithPipelineBenchmark.cs b/src/Benchmark/SendRequest/MediatRVsDispatchRWithPipelineBenchmark.cs index 8fbda67..31c3f05 100644 --- a/src/Benchmark/SendRequest/MediatRVsDispatchRWithPipelineBenchmark.cs +++ b/src/Benchmark/SendRequest/MediatRVsDispatchRWithPipelineBenchmark.cs @@ -15,7 +15,7 @@ public class MediatRVsDispatchWithPipelineRBenchmark private IServiceScope _serviceScopeForMediatRWithPipeline; private IServiceScope _serviceScopeForMediatSgWithPipeline; private IServiceScope _serviceScopeForDispatchRWithPipeline; - private DispatchR.Requests.IMediator _dispatchRWithPipeline; + private DispatchR.IMediator _dispatchRWithPipeline; private IMediator _mediatRWithPipeline; private Mediator.IMediator _mediatSgWithPipeline; private static readonly PingDispatchR StaticDispatchR = new(); @@ -49,7 +49,7 @@ public void Setup() withPipelineServices.AddDispatchR(typeof(PingDispatchR).Assembly); var buildServicesWithoutPipeline = withPipelineServices.BuildServiceProvider(); - _dispatchRWithPipeline = buildServicesWithoutPipeline.CreateScope().ServiceProvider.GetRequiredService(); + _dispatchRWithPipeline = buildServicesWithoutPipeline.CreateScope().ServiceProvider.GetRequiredService(); _mediatRWithPipeline = buildServicesWithoutPipeline.CreateScope().ServiceProvider.GetRequiredService(); _mediatSgWithPipeline = buildServicesWithoutPipeline.CreateScope().ServiceProvider.GetRequiredService(); _serviceScopeForMediatRWithPipeline = buildServicesWithoutPipeline.CreateScope(); @@ -170,7 +170,7 @@ public ValueTask DispatchR_SendRequest_ExistRequest_GetMediator() { return _serviceScopeForDispatchRWithPipeline .ServiceProvider - .GetRequiredService() + .GetRequiredService() .Send(StaticDispatchR, CancellationToken.None); } @@ -250,7 +250,7 @@ public async Task DispatchR_SendRequest_ExistRequest_GetMediator_ExistScope var result = 0; await Parallel.ForEachAsync(ScopesForDispatchRWithPipeline, async (scope, ct) => { - result = await scope.ServiceProvider.GetRequiredService() + result = await scope.ServiceProvider.GetRequiredService() .Send(StaticDispatchR, CancellationToken.None); }); diff --git a/src/Benchmark/StreamRequest/StreamDispatchRCommands.cs b/src/Benchmark/StreamRequest/StreamDispatchRCommands.cs index a4ee92b..fa46c88 100644 --- a/src/Benchmark/StreamRequest/StreamDispatchRCommands.cs +++ b/src/Benchmark/StreamRequest/StreamDispatchRCommands.cs @@ -1,7 +1,6 @@ #pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously using System.Runtime.CompilerServices; -using DispatchR.Requests; -using DispatchR.Requests.Stream; +using DispatchR.Abstractions.Stream; namespace Benchmark.StreamRequest; diff --git a/src/Benchmark/StreamRequest/StreamMediatRVsDispatchRBenchmark.cs b/src/Benchmark/StreamRequest/StreamMediatRVsDispatchRBenchmark.cs index a4afb2c..3fe039e 100644 --- a/src/Benchmark/StreamRequest/StreamMediatRVsDispatchRBenchmark.cs +++ b/src/Benchmark/StreamRequest/StreamMediatRVsDispatchRBenchmark.cs @@ -14,7 +14,7 @@ public class StreamMediatRVsDispatchBenchmark private IServiceScope _serviceScopeForMediatRWithoutPipeline; private IServiceScope _serviceScopeForMediatSgWithoutPipeline; private IServiceScope _serviceScopeForDispatchRWithoutPipeline; - private DispatchR.Requests.IMediator _dispatchRWithoutPipeline; + private DispatchR.IMediator _dispatchRWithoutPipeline; private IMediator _mediatRWithoutPipeline; private Mediator.IMediator _mediatSgWithoutPipeline; private static readonly PingStreamDispatchR StaticStreamDispatchR = new(); @@ -42,7 +42,7 @@ public void Setup() }); withoutPipelineServices.AddDispatchR(typeof(PingStreamDispatchR).Assembly, withPipelines: false); var buildServicesWithoutPipeline = withoutPipelineServices.BuildServiceProvider(); - _dispatchRWithoutPipeline = buildServicesWithoutPipeline.CreateScope().ServiceProvider.GetRequiredService(); + _dispatchRWithoutPipeline = buildServicesWithoutPipeline.CreateScope().ServiceProvider.GetRequiredService(); _mediatRWithoutPipeline = buildServicesWithoutPipeline.CreateScope().ServiceProvider.GetRequiredService(); _mediatSgWithoutPipeline = buildServicesWithoutPipeline.CreateScope().ServiceProvider.GetRequiredService(); _serviceScopeForMediatRWithoutPipeline = buildServicesWithoutPipeline.CreateScope(); @@ -208,7 +208,7 @@ public async Task DispatchR_StreamRequest_With_ExistRequest_GetMediator() { var mediator = _serviceScopeForDispatchRWithoutPipeline .ServiceProvider - .GetRequiredService(); + .GetRequiredService(); var last = 0; await foreach (var response in mediator.CreateStream(StaticStreamDispatchR, CancellationToken.None).ConfigureAwait(false)) @@ -309,7 +309,7 @@ public async Task DispatchR_StreamRequest_With_ExistRequest_GetMediator_Exi var result = 0; await Parallel.ForEachAsync(ScopesForDispatchRWithoutPipeline, async (scope, ct) => { - var mediator = scope.ServiceProvider.GetRequiredService(); + var mediator = scope.ServiceProvider.GetRequiredService(); await foreach (var response in mediator.CreateStream(StaticStreamDispatchR, CancellationToken.None).ConfigureAwait(false)) { result = response; diff --git a/src/Benchmark/StreamRequest/StreamMediatRVsDispatchRWithPipelineBenchmark.cs b/src/Benchmark/StreamRequest/StreamMediatRVsDispatchRWithPipelineBenchmark.cs index 071da65..8d01f8b 100644 --- a/src/Benchmark/StreamRequest/StreamMediatRVsDispatchRWithPipelineBenchmark.cs +++ b/src/Benchmark/StreamRequest/StreamMediatRVsDispatchRWithPipelineBenchmark.cs @@ -15,7 +15,7 @@ public class StreamMediatRVsDispatchWithPipelineRBenchmark private IServiceScope _serviceScopeForMediatRWithPipeline; private IServiceScope _serviceScopeForMediatSgWithPipeline; private IServiceScope _serviceScopeForDispatchRWithPipeline; - private DispatchR.Requests.IMediator _dispatchRWithPipeline; + private DispatchR.IMediator _dispatchRWithPipeline; private IMediator _mediatRWithPipeline; private Mediator.IMediator _mediatSgWithPipeline; private static readonly PingStreamDispatchR StaticStreamDispatchR = new(); @@ -49,7 +49,7 @@ public void Setup() withPipelineServices.AddDispatchR(typeof(PingStreamDispatchR).Assembly); var buildServicesWithoutPipeline = withPipelineServices.BuildServiceProvider(); - _dispatchRWithPipeline = buildServicesWithoutPipeline.CreateScope().ServiceProvider.GetRequiredService(); + _dispatchRWithPipeline = buildServicesWithoutPipeline.CreateScope().ServiceProvider.GetRequiredService(); _mediatRWithPipeline = buildServicesWithoutPipeline.CreateScope().ServiceProvider.GetRequiredService(); _mediatSgWithPipeline = buildServicesWithoutPipeline.CreateScope().ServiceProvider.GetRequiredService(); _serviceScopeForMediatRWithPipeline = buildServicesWithoutPipeline.CreateScope(); @@ -220,7 +220,7 @@ public async Task DispatchR_StreamRequest_ExistRequest_GetMediator() { var mediator = _serviceScopeForDispatchRWithPipeline .ServiceProvider - .GetRequiredService(); + .GetRequiredService(); var result = 0; await foreach (var response in mediator.CreateStream(StaticStreamDispatchR, CancellationToken.None).ConfigureAwait(false)) @@ -323,7 +323,7 @@ public async Task DispatchR_StreamRequest_ExistRequest_GetMediator_ExistSco var result = 0; await Parallel.ForEachAsync(ScopesForDispatchRWithPipeline, async (scope, ct) => { - var mediator = scope.ServiceProvider.GetRequiredService(); + var mediator = scope.ServiceProvider.GetRequiredService(); await foreach (var response in mediator.CreateStream(StaticStreamDispatchR, CancellationToken.None).ConfigureAwait(false)) { result = response; diff --git a/src/DispatchR.Abstractions/DispatchR.Abstractions.csproj b/src/DispatchR.Abstractions/DispatchR.Abstractions.csproj new file mode 100644 index 0000000..bc5afdb --- /dev/null +++ b/src/DispatchR.Abstractions/DispatchR.Abstractions.csproj @@ -0,0 +1,27 @@ + + + + net9.0;net8.0; + enable + enable + icon-mini.png + README.md + DispatchR.Mediator.Abstractions + hasanxdev + + A fast, zero-alloc Mediator pattern alternative to MediatR in .NET – minimal, blazing fast, and DI-friendly (Dependency Injection). + + DispatchR;Mediator;MediatR + https://github.com/hasanxdev/DispatchR + https://github.com/hasanxdev/DispatchR + + + + + + + + + + + diff --git a/src/DispatchR.Abstractions/Notification/INotification.cs b/src/DispatchR.Abstractions/Notification/INotification.cs new file mode 100644 index 0000000..39a5899 --- /dev/null +++ b/src/DispatchR.Abstractions/Notification/INotification.cs @@ -0,0 +1,3 @@ +namespace DispatchR.Abstractions.Notification; + +public interface INotification; \ No newline at end of file diff --git a/src/DispatchR/Requests/Notification/INotificationHandler.cs b/src/DispatchR.Abstractions/Notification/INotificationHandler.cs similarity index 63% rename from src/DispatchR/Requests/Notification/INotificationHandler.cs rename to src/DispatchR.Abstractions/Notification/INotificationHandler.cs index 32e1cb6..c8b0852 100644 --- a/src/DispatchR/Requests/Notification/INotificationHandler.cs +++ b/src/DispatchR.Abstractions/Notification/INotificationHandler.cs @@ -1,7 +1,6 @@ -using System.Runtime.CompilerServices; -using DispatchR.Requests.Send; +using DispatchR.Abstractions.Send; -namespace DispatchR.Requests.Notification; +namespace DispatchR.Abstractions.Notification; public interface INotificationHandler : IRequestHandler where TRequestEvent : INotification { diff --git a/src/DispatchR/Requests/Send/IPipelineBehavior.cs b/src/DispatchR.Abstractions/Send/IPipelineBehavior.cs similarity index 91% rename from src/DispatchR/Requests/Send/IPipelineBehavior.cs rename to src/DispatchR.Abstractions/Send/IPipelineBehavior.cs index c40f6f7..f90cd2c 100644 --- a/src/DispatchR/Requests/Send/IPipelineBehavior.cs +++ b/src/DispatchR.Abstractions/Send/IPipelineBehavior.cs @@ -1,6 +1,6 @@ using System.Runtime.CompilerServices; -namespace DispatchR.Requests.Send; +namespace DispatchR.Abstractions.Send; public interface IPipelineBehavior : IRequestHandler where TRequest : class, IRequest diff --git a/src/DispatchR/Requests/Send/IRequest.cs b/src/DispatchR.Abstractions/Send/IRequest.cs similarity index 72% rename from src/DispatchR/Requests/Send/IRequest.cs rename to src/DispatchR.Abstractions/Send/IRequest.cs index 277fc4a..f443821 100644 --- a/src/DispatchR/Requests/Send/IRequest.cs +++ b/src/DispatchR.Abstractions/Send/IRequest.cs @@ -1,4 +1,4 @@ -namespace DispatchR.Requests.Send; +namespace DispatchR.Abstractions.Send; public interface IRequest; diff --git a/src/DispatchR/Requests/Send/IRequestHandler.cs b/src/DispatchR.Abstractions/Send/IRequestHandler.cs similarity index 89% rename from src/DispatchR/Requests/Send/IRequestHandler.cs rename to src/DispatchR.Abstractions/Send/IRequestHandler.cs index ad6ad24..10fbadd 100644 --- a/src/DispatchR/Requests/Send/IRequestHandler.cs +++ b/src/DispatchR.Abstractions/Send/IRequestHandler.cs @@ -1,6 +1,6 @@ using System.Diagnostics.CodeAnalysis; -namespace DispatchR.Requests.Send; +namespace DispatchR.Abstractions.Send; public interface IRequestHandler { diff --git a/src/DispatchR/Requests/Stream/IStreamPipelineBehavior.cs b/src/DispatchR.Abstractions/Stream/IStreamPipelineBehavior.cs similarity index 85% rename from src/DispatchR/Requests/Stream/IStreamPipelineBehavior.cs rename to src/DispatchR.Abstractions/Stream/IStreamPipelineBehavior.cs index adc41a9..908c2d4 100644 --- a/src/DispatchR/Requests/Stream/IStreamPipelineBehavior.cs +++ b/src/DispatchR.Abstractions/Stream/IStreamPipelineBehavior.cs @@ -1,7 +1,7 @@ using System.Runtime.CompilerServices; -using DispatchR.Requests.Send; +using DispatchR.Abstractions.Send; -namespace DispatchR.Requests.Stream; +namespace DispatchR.Abstractions.Stream; public interface IStreamPipelineBehavior : IStreamRequestHandler where TRequest : class, IStreamRequest diff --git a/src/DispatchR/Requests/Stream/IStreamRequest.cs b/src/DispatchR.Abstractions/Stream/IStreamRequest.cs similarity index 74% rename from src/DispatchR/Requests/Stream/IStreamRequest.cs rename to src/DispatchR.Abstractions/Stream/IStreamRequest.cs index e06e47e..4a1e224 100644 --- a/src/DispatchR/Requests/Stream/IStreamRequest.cs +++ b/src/DispatchR.Abstractions/Stream/IStreamRequest.cs @@ -1,4 +1,4 @@ -namespace DispatchR.Requests.Stream; +namespace DispatchR.Abstractions.Stream; public interface IStreamRequest; diff --git a/src/DispatchR/Requests/Stream/IStreamRequestHandler.cs b/src/DispatchR.Abstractions/Stream/IStreamRequestHandler.cs similarity index 74% rename from src/DispatchR/Requests/Stream/IStreamRequestHandler.cs rename to src/DispatchR.Abstractions/Stream/IStreamRequestHandler.cs index 33e9b08..95e589d 100644 --- a/src/DispatchR/Requests/Stream/IStreamRequestHandler.cs +++ b/src/DispatchR.Abstractions/Stream/IStreamRequestHandler.cs @@ -1,6 +1,6 @@ -using DispatchR.Requests.Send; +using DispatchR.Abstractions.Send; -namespace DispatchR.Requests.Stream; +namespace DispatchR.Abstractions.Stream; public interface IStreamRequestHandler : IRequestHandler where TRequest : class, IStreamRequest { diff --git a/src/DispatchR/Configuration/ServiceRegistrator.cs b/src/DispatchR/Configuration/ServiceRegistrator.cs index aa76b4f..99f726d 100644 --- a/src/DispatchR/Configuration/ServiceRegistrator.cs +++ b/src/DispatchR/Configuration/ServiceRegistrator.cs @@ -1,7 +1,7 @@ -using DispatchR.Requests.Notification; -using DispatchR.Requests.Send; -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using System.Runtime.CompilerServices; +using DispatchR.Abstractions.Notification; +using DispatchR.Abstractions.Send; namespace DispatchR.Configuration { diff --git a/src/DispatchR/DispatchR.csproj b/src/DispatchR/DispatchR.csproj index 19a4885..03be037 100644 --- a/src/DispatchR/DispatchR.csproj +++ b/src/DispatchR/DispatchR.csproj @@ -4,10 +4,11 @@ enable enable README.md + icon-mini.png DispatchR.Mediator hasanxdev - Fast, zero-alloc alternative to MediatR for .NET – minimal, blazing fast, and DI-friendly. + A fast, zero-alloc Mediator pattern alternative to MediatR in .NET – minimal, blazing fast, and DI-friendly (Dependency Injection). DispatchR;Mediator;MediatR https://github.com/hasanxdev/DispatchR @@ -23,5 +24,9 @@ + + + + \ No newline at end of file diff --git a/src/DispatchR/Extensions/ServiceCollectionExtensions.cs b/src/DispatchR/Extensions/ServiceCollectionExtensions.cs index 6f38de2..f522205 100644 --- a/src/DispatchR/Extensions/ServiceCollectionExtensions.cs +++ b/src/DispatchR/Extensions/ServiceCollectionExtensions.cs @@ -1,10 +1,9 @@ using DispatchR.Configuration; -using DispatchR.Requests; -using DispatchR.Requests.Notification; -using DispatchR.Requests.Send; -using DispatchR.Requests.Stream; using Microsoft.Extensions.DependencyInjection; using System.Reflection; +using DispatchR.Abstractions.Notification; +using DispatchR.Abstractions.Send; +using DispatchR.Abstractions.Stream; using DispatchR.Exceptions; namespace DispatchR.Extensions; diff --git a/src/DispatchR/Requests/IMediator.cs b/src/DispatchR/IMediator.cs similarity index 94% rename from src/DispatchR/Requests/IMediator.cs rename to src/DispatchR/IMediator.cs index e99043f..fd5df0c 100644 --- a/src/DispatchR/Requests/IMediator.cs +++ b/src/DispatchR/IMediator.cs @@ -1,11 +1,11 @@ using System.Runtime.CompilerServices; +using DispatchR.Abstractions.Notification; +using DispatchR.Abstractions.Send; +using DispatchR.Abstractions.Stream; using DispatchR.Exceptions; -using DispatchR.Requests.Notification; -using DispatchR.Requests.Send; -using DispatchR.Requests.Stream; using Microsoft.Extensions.DependencyInjection; -namespace DispatchR.Requests; +namespace DispatchR; public interface IMediator { diff --git a/src/DispatchR/Requests/Notification/INotification.cs b/src/DispatchR/Requests/Notification/INotification.cs deleted file mode 100644 index e1a0097..0000000 --- a/src/DispatchR/Requests/Notification/INotification.cs +++ /dev/null @@ -1,3 +0,0 @@ -namespace DispatchR.Requests.Notification; - -public interface INotification; \ No newline at end of file diff --git a/src/Sample/DispatchR/Notification/MultiHandlersNotification.cs b/src/Sample/DispatchR/Notification/MultiHandlersNotification.cs index db91b60..f8b48c7 100644 --- a/src/Sample/DispatchR/Notification/MultiHandlersNotification.cs +++ b/src/Sample/DispatchR/Notification/MultiHandlersNotification.cs @@ -1,4 +1,4 @@ -using DispatchR.Requests.Notification; +using DispatchR.Abstractions.Notification; namespace Sample.DispatchR.Notification; diff --git a/src/Sample/DispatchR/Notification/NotificationOneHandler.cs b/src/Sample/DispatchR/Notification/NotificationOneHandler.cs index e252e92..2ab8fdf 100644 --- a/src/Sample/DispatchR/Notification/NotificationOneHandler.cs +++ b/src/Sample/DispatchR/Notification/NotificationOneHandler.cs @@ -1,5 +1,4 @@ -using DispatchR.Requests.Notification; -using Sample.MediatR.Notification; +using DispatchR.Abstractions.Notification; namespace Sample.DispatchR.Notification; diff --git a/src/Sample/DispatchR/Notification/NotificationThreeHandler.cs b/src/Sample/DispatchR/Notification/NotificationThreeHandler.cs index d32c37f..bba53fe 100644 --- a/src/Sample/DispatchR/Notification/NotificationThreeHandler.cs +++ b/src/Sample/DispatchR/Notification/NotificationThreeHandler.cs @@ -1,4 +1,4 @@ -using DispatchR.Requests.Notification; +using DispatchR.Abstractions.Notification; using Sample.MediatR.Notification; namespace Sample.DispatchR.Notification; diff --git a/src/Sample/DispatchR/Notification/NotificationTwoHandler.cs b/src/Sample/DispatchR/Notification/NotificationTwoHandler.cs index c706707..ec86e2e 100644 --- a/src/Sample/DispatchR/Notification/NotificationTwoHandler.cs +++ b/src/Sample/DispatchR/Notification/NotificationTwoHandler.cs @@ -1,4 +1,4 @@ -using DispatchR.Requests.Notification; +using DispatchR.Abstractions.Notification; using Sample.MediatR.Notification; namespace Sample.DispatchR.Notification; diff --git a/src/Sample/DispatchR/SendRequest/FirstPipelineBehavior.cs b/src/Sample/DispatchR/SendRequest/FirstPipelineBehavior.cs index 213b6fc..b0a131c 100644 --- a/src/Sample/DispatchR/SendRequest/FirstPipelineBehavior.cs +++ b/src/Sample/DispatchR/SendRequest/FirstPipelineBehavior.cs @@ -1,5 +1,4 @@ -using DispatchR.Requests; -using DispatchR.Requests.Send; +using DispatchR.Abstractions.Send; namespace Sample.DispatchR.SendRequest; diff --git a/src/Sample/DispatchR/SendRequest/GenericPipelineBehavior.cs b/src/Sample/DispatchR/SendRequest/GenericPipelineBehavior.cs index 30cc8a6..cd3c530 100644 --- a/src/Sample/DispatchR/SendRequest/GenericPipelineBehavior.cs +++ b/src/Sample/DispatchR/SendRequest/GenericPipelineBehavior.cs @@ -1,4 +1,4 @@ -using DispatchR.Requests.Send; +using DispatchR.Abstractions.Send; namespace Sample.DispatchR.SendRequest; diff --git a/src/Sample/DispatchR/SendRequest/Ping.cs b/src/Sample/DispatchR/SendRequest/Ping.cs index 25306cc..203333a 100644 --- a/src/Sample/DispatchR/SendRequest/Ping.cs +++ b/src/Sample/DispatchR/SendRequest/Ping.cs @@ -1,5 +1,4 @@ -using DispatchR.Requests; -using DispatchR.Requests.Send; +using DispatchR.Abstractions.Send; namespace Sample.DispatchR.SendRequest { diff --git a/src/Sample/DispatchR/SendRequest/PingHandler.cs b/src/Sample/DispatchR/SendRequest/PingHandler.cs index 0a671c0..04e5514 100644 --- a/src/Sample/DispatchR/SendRequest/PingHandler.cs +++ b/src/Sample/DispatchR/SendRequest/PingHandler.cs @@ -1,5 +1,4 @@ -using DispatchR.Requests; -using DispatchR.Requests.Send; +using DispatchR.Abstractions.Send; namespace Sample.DispatchR.SendRequest { diff --git a/src/Sample/DispatchR/SendRequest/SecondPipelineBehavior.cs b/src/Sample/DispatchR/SendRequest/SecondPipelineBehavior.cs index 5a6468f..13383f7 100644 --- a/src/Sample/DispatchR/SendRequest/SecondPipelineBehavior.cs +++ b/src/Sample/DispatchR/SendRequest/SecondPipelineBehavior.cs @@ -1,5 +1,4 @@ -using DispatchR.Requests; -using DispatchR.Requests.Send; +using DispatchR.Abstractions.Send; namespace Sample.DispatchR.SendRequest { diff --git a/src/Sample/DispatchR/StreamRequest/CounterPipelineStreamHandler.cs b/src/Sample/DispatchR/StreamRequest/CounterPipelineStreamHandler.cs index 0f44170..e3e2a0f 100644 --- a/src/Sample/DispatchR/StreamRequest/CounterPipelineStreamHandler.cs +++ b/src/Sample/DispatchR/StreamRequest/CounterPipelineStreamHandler.cs @@ -1,6 +1,6 @@  using System.Runtime.CompilerServices; -using DispatchR.Requests.Stream; +using DispatchR.Abstractions.Stream; namespace Sample.DispatchR.StreamRequest; diff --git a/src/Sample/DispatchR/StreamRequest/CounterStreamHandler.cs b/src/Sample/DispatchR/StreamRequest/CounterStreamHandler.cs index 58a567f..2a30dc5 100644 --- a/src/Sample/DispatchR/StreamRequest/CounterStreamHandler.cs +++ b/src/Sample/DispatchR/StreamRequest/CounterStreamHandler.cs @@ -1,5 +1,5 @@ using System.Runtime.CompilerServices; -using DispatchR.Requests.Stream; +using DispatchR.Abstractions.Stream; namespace Sample.DispatchR.StreamRequest; diff --git a/src/Sample/DispatchR/StreamRequest/CounterStreamRequest.cs b/src/Sample/DispatchR/StreamRequest/CounterStreamRequest.cs index 0193c32..995f79e 100644 --- a/src/Sample/DispatchR/StreamRequest/CounterStreamRequest.cs +++ b/src/Sample/DispatchR/StreamRequest/CounterStreamRequest.cs @@ -1,4 +1,4 @@ -using DispatchR.Requests.Stream; +using DispatchR.Abstractions.Stream; namespace Sample.DispatchR.StreamRequest; diff --git a/src/Sample/DispatchR/StreamRequest/GenericPipelineBehavior.cs b/src/Sample/DispatchR/StreamRequest/GenericPipelineBehavior.cs index ef0ec47..0378708 100644 --- a/src/Sample/DispatchR/StreamRequest/GenericPipelineBehavior.cs +++ b/src/Sample/DispatchR/StreamRequest/GenericPipelineBehavior.cs @@ -1,5 +1,4 @@ -using System.Runtime.CompilerServices; -using DispatchR.Requests.Stream; +using DispatchR.Abstractions.Stream; namespace Sample.DispatchR.StreamRequest; diff --git a/src/Sample/Program.cs b/src/Sample/Program.cs index 62d7caf..126b418 100644 --- a/src/Sample/Program.cs +++ b/src/Sample/Program.cs @@ -72,7 +72,7 @@ => mediatR.Send(new MediatRSample.Ping(), cancellationToken)) .WithName("SendInMediatRWithPipeline"); -app.MapGet("/Send/DispatchR", (DispatchR.Requests.IMediator dispatchR, CancellationToken cancellationToken) +app.MapGet("/Send/DispatchR", (DispatchR.IMediator dispatchR, CancellationToken cancellationToken) => dispatchR.Send(new DispatchRSample.Ping(), cancellationToken)) .WithName("SendInDispatchRWithPipeline"); @@ -94,7 +94,7 @@ return "It works"; }); -app.MapGet("/Stream/DispatchR", async (DispatchR.Requests.IMediator dispatchR, ILogger logger) => +app.MapGet("/Stream/DispatchR", async (DispatchR.IMediator dispatchR, ILogger logger) => { CancellationTokenSource cts = new(); int count = 0; @@ -118,7 +118,7 @@ return "It works"; }); -app.MapGet("/Notification/DispatchR", async (DispatchR.Requests.IMediator mediator, ILogger logger) => +app.MapGet("/Notification/DispatchR", async (DispatchR.IMediator mediator, ILogger logger) => { await mediator.Publish(new DispatchRNotificationSample.MultiHandlersNotification(Guid.Empty), CancellationToken.None); return "It works"; diff --git a/tests/DispatchR.IntegrationTest/NotificationTests.cs b/tests/DispatchR.IntegrationTest/NotificationTests.cs index 477a342..9fec49e 100644 --- a/tests/DispatchR.IntegrationTest/NotificationTests.cs +++ b/tests/DispatchR.IntegrationTest/NotificationTests.cs @@ -1,12 +1,8 @@ +using DispatchR.Abstractions.Notification; using DispatchR.Extensions; -using DispatchR.Requests; -using DispatchR.Requests.Notification; -using DispatchR.Requests.Send; using DispatchR.TestCommon.Fixtures; using DispatchR.TestCommon.Fixtures.Notification; -using DispatchR.TestCommon.Fixtures.SendRequest.ValueTask; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.DependencyInjection.Extensions; using Moq; namespace DispatchR.IntegrationTest; diff --git a/tests/DispatchR.IntegrationTest/RequestHandlerTests.cs b/tests/DispatchR.IntegrationTest/RequestHandlerTests.cs index 746de8d..ad86a11 100644 --- a/tests/DispatchR.IntegrationTest/RequestHandlerTests.cs +++ b/tests/DispatchR.IntegrationTest/RequestHandlerTests.cs @@ -1,9 +1,6 @@ +using DispatchR.Abstractions.Send; using DispatchR.Extensions; -using DispatchR.Requests; -using DispatchR.Requests.Send; using DispatchR.TestCommon.Fixtures; -using DispatchR.TestCommon.Fixtures.SendRequest.Sync; -using DispatchR.TestCommon.Fixtures.SendRequest.Task; using DispatchR.TestCommon.Fixtures.SendRequest.ValueTask; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; diff --git a/tests/DispatchR.IntegrationTest/StreamRequestHandlerTests.cs b/tests/DispatchR.IntegrationTest/StreamRequestHandlerTests.cs index 181d239..41457dd 100644 --- a/tests/DispatchR.IntegrationTest/StreamRequestHandlerTests.cs +++ b/tests/DispatchR.IntegrationTest/StreamRequestHandlerTests.cs @@ -1,11 +1,7 @@ +using DispatchR.Abstractions.Send; +using DispatchR.Abstractions.Stream; using DispatchR.Extensions; -using DispatchR.Requests; -using DispatchR.Requests.Send; -using DispatchR.Requests.Stream; using DispatchR.TestCommon.Fixtures; -using DispatchR.TestCommon.Fixtures.SendRequest.Sync; -using DispatchR.TestCommon.Fixtures.SendRequest.Task; -using DispatchR.TestCommon.Fixtures.SendRequest.ValueTask; using DispatchR.TestCommon.Fixtures.StreamRequest; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; diff --git a/tests/DispatchR.TestCommon/Fixtures/Notification/MultiHandlersNotification.cs b/tests/DispatchR.TestCommon/Fixtures/Notification/MultiHandlersNotification.cs index 70195cc..9f20f6a 100644 --- a/tests/DispatchR.TestCommon/Fixtures/Notification/MultiHandlersNotification.cs +++ b/tests/DispatchR.TestCommon/Fixtures/Notification/MultiHandlersNotification.cs @@ -1,4 +1,4 @@ -using DispatchR.Requests.Notification; +using DispatchR.Abstractions.Notification; namespace DispatchR.TestCommon.Fixtures.Notification; diff --git a/tests/DispatchR.TestCommon/Fixtures/Notification/NotificationOneHandler.cs b/tests/DispatchR.TestCommon/Fixtures/Notification/NotificationOneHandler.cs index 284de16..37f84ea 100644 --- a/tests/DispatchR.TestCommon/Fixtures/Notification/NotificationOneHandler.cs +++ b/tests/DispatchR.TestCommon/Fixtures/Notification/NotificationOneHandler.cs @@ -1,4 +1,4 @@ -using DispatchR.Requests.Notification; +using DispatchR.Abstractions.Notification; namespace DispatchR.TestCommon.Fixtures.Notification; diff --git a/tests/DispatchR.TestCommon/Fixtures/Notification/NotificationThreeHandler.cs b/tests/DispatchR.TestCommon/Fixtures/Notification/NotificationThreeHandler.cs index 3da0fa0..39c68b5 100644 --- a/tests/DispatchR.TestCommon/Fixtures/Notification/NotificationThreeHandler.cs +++ b/tests/DispatchR.TestCommon/Fixtures/Notification/NotificationThreeHandler.cs @@ -1,4 +1,4 @@ -using DispatchR.Requests.Notification; +using DispatchR.Abstractions.Notification; namespace DispatchR.TestCommon.Fixtures.Notification; diff --git a/tests/DispatchR.TestCommon/Fixtures/Notification/NotificationTwoHandler.cs b/tests/DispatchR.TestCommon/Fixtures/Notification/NotificationTwoHandler.cs index 8750f9c..2a67bf0 100644 --- a/tests/DispatchR.TestCommon/Fixtures/Notification/NotificationTwoHandler.cs +++ b/tests/DispatchR.TestCommon/Fixtures/Notification/NotificationTwoHandler.cs @@ -1,4 +1,4 @@ -using DispatchR.Requests.Notification; +using DispatchR.Abstractions.Notification; namespace DispatchR.TestCommon.Fixtures.Notification; diff --git a/tests/DispatchR.TestCommon/Fixtures/SendRequest/GenericPipelineBehaviorWithResponse.cs b/tests/DispatchR.TestCommon/Fixtures/SendRequest/GenericPipelineBehaviorWithResponse.cs index a34bef2..ae9f1f0 100644 --- a/tests/DispatchR.TestCommon/Fixtures/SendRequest/GenericPipelineBehaviorWithResponse.cs +++ b/tests/DispatchR.TestCommon/Fixtures/SendRequest/GenericPipelineBehaviorWithResponse.cs @@ -1,4 +1,4 @@ -using DispatchR.Requests.Send; +using DispatchR.Abstractions.Send; namespace DispatchR.TestCommon.Fixtures.SendRequest; diff --git a/tests/DispatchR.TestCommon/Fixtures/SendRequest/GenericPipelineBehaviorWithoutResponse.cs b/tests/DispatchR.TestCommon/Fixtures/SendRequest/GenericPipelineBehaviorWithoutResponse.cs index 419dcc2..eccc2d3 100644 --- a/tests/DispatchR.TestCommon/Fixtures/SendRequest/GenericPipelineBehaviorWithoutResponse.cs +++ b/tests/DispatchR.TestCommon/Fixtures/SendRequest/GenericPipelineBehaviorWithoutResponse.cs @@ -1,4 +1,4 @@ -using DispatchR.Requests.Send; +using DispatchR.Abstractions.Send; namespace DispatchR.TestCommon.Fixtures.SendRequest; diff --git a/tests/DispatchR.TestCommon/Fixtures/SendRequest/RequestWithoutHandler.cs b/tests/DispatchR.TestCommon/Fixtures/SendRequest/RequestWithoutHandler.cs index 8fe8b44..0e7a5fd 100644 --- a/tests/DispatchR.TestCommon/Fixtures/SendRequest/RequestWithoutHandler.cs +++ b/tests/DispatchR.TestCommon/Fixtures/SendRequest/RequestWithoutHandler.cs @@ -1,4 +1,4 @@ -using DispatchR.Requests.Send; +using DispatchR.Abstractions.Send; namespace DispatchR.TestCommon.Fixtures.SendRequest; diff --git a/tests/DispatchR.TestCommon/Fixtures/SendRequest/ReusedInScopedLifetime/RequestReusedInScopedLifetime.cs b/tests/DispatchR.TestCommon/Fixtures/SendRequest/ReusedInScopedLifetime/RequestReusedInScopedLifetime.cs index b1ed25c..00e3af4 100644 --- a/tests/DispatchR.TestCommon/Fixtures/SendRequest/ReusedInScopedLifetime/RequestReusedInScopedLifetime.cs +++ b/tests/DispatchR.TestCommon/Fixtures/SendRequest/ReusedInScopedLifetime/RequestReusedInScopedLifetime.cs @@ -1,4 +1,4 @@ -using DispatchR.Requests.Send; +using DispatchR.Abstractions.Send; namespace DispatchR.TestCommon.Fixtures.SendRequest.ReusedInScopedLifetime; diff --git a/tests/DispatchR.TestCommon/Fixtures/SendRequest/ReusedInScopedLifetime/RequestReusedInScopedLifetimeHandler.cs b/tests/DispatchR.TestCommon/Fixtures/SendRequest/ReusedInScopedLifetime/RequestReusedInScopedLifetimeHandler.cs index d5c00a7..7043936 100644 --- a/tests/DispatchR.TestCommon/Fixtures/SendRequest/ReusedInScopedLifetime/RequestReusedInScopedLifetimeHandler.cs +++ b/tests/DispatchR.TestCommon/Fixtures/SendRequest/ReusedInScopedLifetime/RequestReusedInScopedLifetimeHandler.cs @@ -1,4 +1,4 @@ -using DispatchR.Requests.Send; +using DispatchR.Abstractions.Send; namespace DispatchR.TestCommon.Fixtures.SendRequest.ReusedInScopedLifetime; diff --git a/tests/DispatchR.TestCommon/Fixtures/SendRequest/Sync/Ping.cs b/tests/DispatchR.TestCommon/Fixtures/SendRequest/Sync/Ping.cs index 5bf74c0..ef2761b 100644 --- a/tests/DispatchR.TestCommon/Fixtures/SendRequest/Sync/Ping.cs +++ b/tests/DispatchR.TestCommon/Fixtures/SendRequest/Sync/Ping.cs @@ -1,4 +1,4 @@ -using DispatchR.Requests.Send; +using DispatchR.Abstractions.Send; namespace DispatchR.TestCommon.Fixtures.SendRequest.Sync; diff --git a/tests/DispatchR.TestCommon/Fixtures/SendRequest/Sync/PingHandler.cs b/tests/DispatchR.TestCommon/Fixtures/SendRequest/Sync/PingHandler.cs index 0052566..823edd7 100644 --- a/tests/DispatchR.TestCommon/Fixtures/SendRequest/Sync/PingHandler.cs +++ b/tests/DispatchR.TestCommon/Fixtures/SendRequest/Sync/PingHandler.cs @@ -1,4 +1,4 @@ -using DispatchR.Requests.Send; +using DispatchR.Abstractions.Send; namespace DispatchR.TestCommon.Fixtures.SendRequest.Sync; diff --git a/tests/DispatchR.TestCommon/Fixtures/SendRequest/Task/PingTask.cs b/tests/DispatchR.TestCommon/Fixtures/SendRequest/Task/PingTask.cs index 4f24a9c..18c6f54 100644 --- a/tests/DispatchR.TestCommon/Fixtures/SendRequest/Task/PingTask.cs +++ b/tests/DispatchR.TestCommon/Fixtures/SendRequest/Task/PingTask.cs @@ -1,4 +1,4 @@ -using DispatchR.Requests.Send; +using DispatchR.Abstractions.Send; namespace DispatchR.TestCommon.Fixtures.SendRequest.Task; diff --git a/tests/DispatchR.TestCommon/Fixtures/SendRequest/Task/PingTaskHandler.cs b/tests/DispatchR.TestCommon/Fixtures/SendRequest/Task/PingTaskHandler.cs index 0a30bb3..a6a103c 100644 --- a/tests/DispatchR.TestCommon/Fixtures/SendRequest/Task/PingTaskHandler.cs +++ b/tests/DispatchR.TestCommon/Fixtures/SendRequest/Task/PingTaskHandler.cs @@ -1,4 +1,4 @@ -using DispatchR.Requests.Send; +using DispatchR.Abstractions.Send; namespace DispatchR.TestCommon.Fixtures.SendRequest.Task; diff --git a/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTask/PingValueTask.cs b/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTask/PingValueTask.cs index a5dab0b..9a31f80 100644 --- a/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTask/PingValueTask.cs +++ b/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTask/PingValueTask.cs @@ -1,4 +1,4 @@ -using DispatchR.Requests.Send; +using DispatchR.Abstractions.Send; namespace DispatchR.TestCommon.Fixtures.SendRequest.ValueTask; diff --git a/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTask/PingValueTaskFirstPipelineBehavior.cs b/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTask/PingValueTaskFirstPipelineBehavior.cs index 10a1b80..83272dd 100644 --- a/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTask/PingValueTaskFirstPipelineBehavior.cs +++ b/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTask/PingValueTaskFirstPipelineBehavior.cs @@ -1,4 +1,4 @@ -using DispatchR.Requests.Send; +using DispatchR.Abstractions.Send; namespace DispatchR.TestCommon.Fixtures.SendRequest.ValueTask; diff --git a/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTask/PingValueTaskHandler.cs b/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTask/PingValueTaskHandler.cs index 75bccf2..687b279 100644 --- a/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTask/PingValueTaskHandler.cs +++ b/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTask/PingValueTaskHandler.cs @@ -1,4 +1,4 @@ -using DispatchR.Requests.Send; +using DispatchR.Abstractions.Send; namespace DispatchR.TestCommon.Fixtures.SendRequest.ValueTask; diff --git a/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTask/PingValueTaskSecondPipelineBehavior.cs b/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTask/PingValueTaskSecondPipelineBehavior.cs index 62c0ecc..cab852b 100644 --- a/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTask/PingValueTaskSecondPipelineBehavior.cs +++ b/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTask/PingValueTaskSecondPipelineBehavior.cs @@ -1,4 +1,4 @@ -using DispatchR.Requests.Send; +using DispatchR.Abstractions.Send; namespace DispatchR.TestCommon.Fixtures.SendRequest.ValueTask { diff --git a/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTaskWithOutResponse/PingValueTask.cs b/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTaskWithOutResponse/PingValueTask.cs index 31ff982..11e13f5 100644 --- a/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTaskWithOutResponse/PingValueTask.cs +++ b/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTaskWithOutResponse/PingValueTask.cs @@ -1,4 +1,4 @@ -using DispatchR.Requests.Send; +using DispatchR.Abstractions.Send; namespace DispatchR.TestCommon.Fixtures.SendRequest.ValueTaskWithOutResponse; diff --git a/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTaskWithOutResponse/PingValueTaskFirstPipelineBehavior.cs b/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTaskWithOutResponse/PingValueTaskFirstPipelineBehavior.cs index 584f206..63a8a33 100644 --- a/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTaskWithOutResponse/PingValueTaskFirstPipelineBehavior.cs +++ b/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTaskWithOutResponse/PingValueTaskFirstPipelineBehavior.cs @@ -1,4 +1,4 @@ -using DispatchR.Requests.Send; +using DispatchR.Abstractions.Send; namespace DispatchR.TestCommon.Fixtures.SendRequest.ValueTaskWithOutResponse; diff --git a/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTaskWithOutResponse/PingValueTaskHandler.cs b/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTaskWithOutResponse/PingValueTaskHandler.cs index 9b54119..170a477 100644 --- a/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTaskWithOutResponse/PingValueTaskHandler.cs +++ b/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTaskWithOutResponse/PingValueTaskHandler.cs @@ -1,4 +1,4 @@ -using DispatchR.Requests.Send; +using DispatchR.Abstractions.Send; namespace DispatchR.TestCommon.Fixtures.SendRequest.ValueTaskWithOutResponse; diff --git a/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTaskWithOutResponse/PingValueTaskSecondPipelineBehavior.cs b/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTaskWithOutResponse/PingValueTaskSecondPipelineBehavior.cs index f04f92e..0d1ee8d 100644 --- a/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTaskWithOutResponse/PingValueTaskSecondPipelineBehavior.cs +++ b/tests/DispatchR.TestCommon/Fixtures/SendRequest/ValueTaskWithOutResponse/PingValueTaskSecondPipelineBehavior.cs @@ -1,4 +1,4 @@ -using DispatchR.Requests.Send; +using DispatchR.Abstractions.Send; namespace DispatchR.TestCommon.Fixtures.SendRequest.ValueTaskWithOutResponse { diff --git a/tests/DispatchR.TestCommon/Fixtures/StreamRequest/CounterPipelineStreamHandler.cs b/tests/DispatchR.TestCommon/Fixtures/StreamRequest/CounterPipelineStreamHandler.cs index 4f3b980..848f82a 100644 --- a/tests/DispatchR.TestCommon/Fixtures/StreamRequest/CounterPipelineStreamHandler.cs +++ b/tests/DispatchR.TestCommon/Fixtures/StreamRequest/CounterPipelineStreamHandler.cs @@ -1,5 +1,5 @@ using System.Runtime.CompilerServices; -using DispatchR.Requests.Stream; +using DispatchR.Abstractions.Stream; namespace DispatchR.TestCommon.Fixtures.StreamRequest; diff --git a/tests/DispatchR.TestCommon/Fixtures/StreamRequest/CounterStreamHandler.cs b/tests/DispatchR.TestCommon/Fixtures/StreamRequest/CounterStreamHandler.cs index 7da1265..fb619cb 100644 --- a/tests/DispatchR.TestCommon/Fixtures/StreamRequest/CounterStreamHandler.cs +++ b/tests/DispatchR.TestCommon/Fixtures/StreamRequest/CounterStreamHandler.cs @@ -1,5 +1,5 @@ using System.Runtime.CompilerServices; -using DispatchR.Requests.Stream; +using DispatchR.Abstractions.Stream; namespace DispatchR.TestCommon.Fixtures.StreamRequest; diff --git a/tests/DispatchR.TestCommon/Fixtures/StreamRequest/CounterStreamRequest.cs b/tests/DispatchR.TestCommon/Fixtures/StreamRequest/CounterStreamRequest.cs index 7111fac..361dc9c 100644 --- a/tests/DispatchR.TestCommon/Fixtures/StreamRequest/CounterStreamRequest.cs +++ b/tests/DispatchR.TestCommon/Fixtures/StreamRequest/CounterStreamRequest.cs @@ -1,4 +1,4 @@ -using DispatchR.Requests.Stream; +using DispatchR.Abstractions.Stream; namespace DispatchR.TestCommon.Fixtures.StreamRequest; diff --git a/tests/DispatchR.TestCommon/Fixtures/StreamRequest/GenericPipelineBehavior.cs b/tests/DispatchR.TestCommon/Fixtures/StreamRequest/GenericPipelineBehavior.cs index 1e07078..7a0b041 100644 --- a/tests/DispatchR.TestCommon/Fixtures/StreamRequest/GenericPipelineBehavior.cs +++ b/tests/DispatchR.TestCommon/Fixtures/StreamRequest/GenericPipelineBehavior.cs @@ -1,4 +1,4 @@ -using DispatchR.Requests.Stream; +using DispatchR.Abstractions.Stream; namespace DispatchR.TestCommon.Fixtures.StreamRequest; diff --git a/tests/DispatchR.UnitTest/AddDispatchRConfigurationTests.cs b/tests/DispatchR.UnitTest/AddDispatchRConfigurationTests.cs index f8c3b25..cd87485 100644 --- a/tests/DispatchR.UnitTest/AddDispatchRConfigurationTests.cs +++ b/tests/DispatchR.UnitTest/AddDispatchRConfigurationTests.cs @@ -1,7 +1,6 @@ +using DispatchR.Abstractions.Stream; using DispatchR.Exceptions; using DispatchR.Extensions; -using DispatchR.Requests; -using DispatchR.Requests.Stream; using DispatchR.TestCommon.Fixtures; using DispatchR.TestCommon.Fixtures.Notification; using DispatchR.TestCommon.Fixtures.SendRequest; diff --git a/tests/DispatchR.UnitTest/RequestHandlerTests.cs b/tests/DispatchR.UnitTest/RequestHandlerTests.cs index fb78e28..4914b8a 100644 --- a/tests/DispatchR.UnitTest/RequestHandlerTests.cs +++ b/tests/DispatchR.UnitTest/RequestHandlerTests.cs @@ -1,7 +1,5 @@ -using DispatchR.Configuration; using DispatchR.Exceptions; using DispatchR.Extensions; -using DispatchR.Requests; using DispatchR.TestCommon.Fixtures; using DispatchR.TestCommon.Fixtures.SendRequest; using DispatchR.TestCommon.Fixtures.SendRequest.ReusedInScopedLifetime; @@ -9,7 +7,6 @@ using DispatchR.TestCommon.Fixtures.SendRequest.Task; using DispatchR.TestCommon.Fixtures.SendRequest.ValueTask; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.DependencyInjection; namespace DispatchR.UnitTest; diff --git a/tests/DispatchR.UnitTest/StreamRequestHandlerTests.cs b/tests/DispatchR.UnitTest/StreamRequestHandlerTests.cs index 8829949..4e11ecb 100644 --- a/tests/DispatchR.UnitTest/StreamRequestHandlerTests.cs +++ b/tests/DispatchR.UnitTest/StreamRequestHandlerTests.cs @@ -1,14 +1,5 @@ -using DispatchR.Configuration; -using DispatchR.Exceptions; using DispatchR.Extensions; -using DispatchR.Requests; using DispatchR.TestCommon.Fixtures; -using DispatchR.TestCommon.Fixtures.SendRequest; -using DispatchR.TestCommon.Fixtures.SendRequest.ReusedInScopedLifetime; -using DispatchR.TestCommon.Fixtures.SendRequest.Sync; -using DispatchR.TestCommon.Fixtures.SendRequest.Task; -using DispatchR.TestCommon.Fixtures.SendRequest.ValueTask; -using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection; namespace DispatchR.UnitTest;