Skip to content
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 .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.x'
dotnet-version: '10.x'

- name: Install Coverlet
run: dotnet tool install --global coverlet.console
Expand Down
25 changes: 25 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Aspire.Hosting" Version="13.3.0" />
<PackageVersion Include="Aspire.Hosting.AppHost" Version="13.3.0" />
<PackageVersion Include="BenchmarkDotNet" Version="0.15.8" />
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
<PackageVersion Include="coverlet.msbuild" Version="6.0.4" />
<PackageVersion Include="Mediator.Abstractions" Version="3.0.2" />
<PackageVersion Include="Mediator.SourceGenerator" Version="3.0.2" />
<PackageVersion Include="MediatR" Version="14.1.0" />
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="10.0.7" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.7" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" Condition="'$(TargetFramework)' == 'net8.0'" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.15" Condition="'$(TargetFramework)' == 'net9.0'" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.7" Condition="'$(TargetFramework)' == 'net10.0'" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.5.1" />
<PackageVersion Include="Moq" Version="4.20.72" />
<PackageVersion Include="Scalar.AspNetCore" Version="2.14.11" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
<PackageVersion Include="xunit.v3" Version="3.2.2" />
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions DispatchR.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
README.md = README.md
.gitignore = .gitignore
CHANGELOG.md = CHANGELOG.md
Directory.Packages.props = Directory.Packages.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{0C407C1E-9E95-40A5-ABCA-52AACCC49C96}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsAspireHost>true</IsAspireHost>
<UserSecretsId>0177c1f9-bc41-4a2b-9dd3-cdd0d2e2f842</UserSecretsId>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Aspire.Hosting.AppHost" Version="9.3.1" />
<PackageReference Include="Aspire.Hosting.AppHost" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Aspire.Hosting" Version="9.3.2" />
<PackageReference Include="Aspire.Hosting" />
</ItemGroup>

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Aspire.Hosting" Version="9.3.2" />
<PackageReference Include="Aspire.Hosting" />
</ItemGroup>

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand Down
10 changes: 5 additions & 5 deletions src/Benchmark/Benchmark.csproj
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<Optimize>true</Optimize>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
<PackageReference Include="BenchmarkDotNet" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="MediatR" Version="12.5.0" />
<PackageReference Include="MediatR" />
<!-- <PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="11.1.0" /> -->
</ItemGroup>

<ItemGroup>
<PackageReference Include="Mediator.Abstractions" Version="2.1.7" />
<PackageReference Include="Mediator.SourceGenerator" Version="2.1.7">
<PackageReference Include="Mediator.Abstractions" />
<PackageReference Include="Mediator.SourceGenerator">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion src/Benchmark/Notification/NotificationBenchmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Benchmark.Notification.SingleHandler;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Order;
using DispatchR;
using DispatchR.Extensions;

namespace Benchmark.Notification;
Expand Down Expand Up @@ -43,6 +42,7 @@ public enum ScenarioType
public void Setup()
{
var services = new ServiceCollection();
services.AddLogging();
Copy link
Copy Markdown
Owner

@hasanxdev hasanxdev May 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this line and similar lines are redundant, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to add it to make the benchmark work with the new version of MediatR

services.AddMediator(opts =>
{
opts.ServiceLifetime = ServiceLifetime.Scoped;
Expand Down
1 change: 1 addition & 0 deletions src/Benchmark/SendRequest/MediatRVsDispatchRBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class MediatRVsDispatchBenchmark
public void Setup()
{
var withoutPipelineServices = new ServiceCollection();
withoutPipelineServices.AddLogging();
withoutPipelineServices.AddMediatR(cfg =>
{
cfg.Lifetime = ServiceLifetime.Scoped;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class MediatRVsDispatchWithPipelineRBenchmark
public void Setup()
{
var withPipelineServices = new ServiceCollection();

withPipelineServices.AddLogging();
withPipelineServices.AddMediatR(cfg =>
{
cfg.Lifetime = ServiceLifetime.Scoped;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class StreamMediatRVsDispatchBenchmark
public void Setup()
{
var withoutPipelineServices = new ServiceCollection();
withoutPipelineServices.AddLogging();
withoutPipelineServices.AddMediatR(cfg =>
{
cfg.Lifetime = ServiceLifetime.Scoped;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class StreamMediatRVsDispatchWithPipelineRBenchmark
public void Setup()
{
var withPipelineServices = new ServiceCollection();

withPipelineServices.AddLogging();
withPipelineServices.AddMediatR(cfg =>
{
cfg.Lifetime = ServiceLifetime.Scoped;
Expand Down
3 changes: 1 addition & 2 deletions src/Benchmark/StreamRequest/StreamMediatSGCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ public async IAsyncEnumerable<int> Handle(PingStreamMediatSg request, [Enumerato

public sealed class LoggingBehaviorMediatSg : IStreamPipelineBehavior<PingStreamMediatSg, int>
{
// version 2.x
public async IAsyncEnumerable<int> Handle(PingStreamMediatSg message, [EnumeratorCancellation] CancellationToken cancellationToken, StreamHandlerDelegate<PingStreamMediatSg, int> next)
public async IAsyncEnumerable<int> Handle(PingStreamMediatSg message, StreamHandlerDelegate<PingStreamMediatSg, int> next, [EnumeratorCancellation] CancellationToken cancellationToken)
{
await foreach (var response in next(message, cancellationToken).ConfigureAwait(false))
{
Expand Down
2 changes: 1 addition & 1 deletion src/DispatchR.Abstractions/DispatchR.Abstractions.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net9.0;net8.0;</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageIcon>icon-mini.png</PackageIcon>
Expand Down
11 changes: 3 additions & 8 deletions src/DispatchR/DispatchR.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageReadmeFile>README.md</PackageReadmeFile>
Expand All @@ -15,12 +15,7 @@
<RepositoryUrl>https://github.com/hasanxdev/DispatchR</RepositoryUrl>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions"
Version="8.0.2"
Condition="'$(TargetFramework)' == 'net8.0'" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions"
Version="9.0.6"
Condition="'$(TargetFramework)' == 'net9.0'" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
Expand Down
5 changes: 3 additions & 2 deletions src/Sample/DispatchR/StreamRequest/GenericPipelineBehavior.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
using DispatchR.Abstractions.Stream;
using System.Runtime.CompilerServices;
using DispatchR.Abstractions.Stream;

namespace Sample.DispatchR.StreamRequest;

public class GenericPipelineBehavior<TRequest, TResponse>(ILogger<GenericPipelineBehavior<TRequest, TResponse>> logger)
: IStreamPipelineBehavior<TRequest, TResponse>
where TRequest : class, IStreamRequest<TRequest, TResponse>
{
public async IAsyncEnumerable<TResponse> Handle(TRequest request, CancellationToken cancellationToken)
public async IAsyncEnumerable<TResponse> Handle(TRequest request, [EnumeratorCancellation] CancellationToken cancellationToken)
{
logger.LogInformation("Generic Request Pipeline");
await foreach (var response in NextPipeline.Handle(request, cancellationToken).ConfigureAwait(false))
Expand Down
10 changes: 5 additions & 5 deletions src/Sample/Sample.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.0"/>
<PackageReference Include="MediatR" Version="12.5.0" />
<PackageReference Include="Scalar.AspNetCore" Version="2.4.7" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" />
<PackageReference Include="MediatR" />
<PackageReference Include="Scalar.AspNetCore" />
</ItemGroup>

<ItemGroup>
Expand Down
23 changes: 13 additions & 10 deletions tests/DispatchR.IntegrationTest/DispatchR.IntegrationTest.csproj
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.6" />
<PackageReference Include="coverlet.msbuild" Version="6.0.4">
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
<PackageReference Include="coverlet.msbuild">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.4">
<PackageReference Include="coverlet.collector">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0"/>
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="xunit" Version="2.9.2"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Moq" />
<PackageReference Include="xunit.runner.visualstudio">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit.v3" />
</ItemGroup>

<ItemGroup>
<Using Include="Xunit"/>
<Using Include="Xunit" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion tests/DispatchR.TestCommon/DispatchR.TestCommon.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Runtime.CompilerServices;
using DispatchR.Abstractions.Stream;

namespace DispatchR.TestCommon.Fixtures.StreamRequest;
Expand All @@ -6,7 +7,7 @@
: IStreamPipelineBehavior<TRequest, TResponse>
where TRequest : class, IStreamRequest<TRequest, TResponse>, new()
{
public async IAsyncEnumerable<TResponse> Handle(TRequest request, CancellationToken cancellationToken)
public async IAsyncEnumerable<TResponse> Handle(TRequest request, [EnumeratorCancellation] CancellationToken cancellationToken)
{
await foreach (var response in NextPipeline.Handle(request, cancellationToken).ConfigureAwait(false))
{
Expand All @@ -14,4 +15,4 @@
}
}

public IStreamRequestHandler<TRequest, TResponse> NextPipeline { get; set; }

Check warning on line 18 in tests/DispatchR.TestCommon/Fixtures/StreamRequest/GenericPipelineBehavior.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Non-nullable property 'NextPipeline' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
Expand Down
18 changes: 9 additions & 9 deletions tests/DispatchR.UnitTest/DispatchR.UnitTest.csproj
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="6.0.4">
<PackageReference Include="coverlet.msbuild">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.4">
<PackageReference Include="coverlet.collector">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.6" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.1">
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Moq" />
<PackageReference Include="xunit.runner.visualstudio">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit.v3" />
</ItemGroup>

<ItemGroup>
<Using Include="Xunit"/>
<Using Include="Xunit" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading