Skip to content

Commit e542483

Browse files
committed
update to NSB 10
1 parent e78646f commit e542483

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project>
33
<PropertyGroup>
4-
<Version>3.1.0</Version>
4+
<Version>4.0.0</Version>
55
<AssemblyVersion>1.0.0</AssemblyVersion>
66
<LangVersion>preview</LangVersion>
77
<PackageTags>NServiceBus, Handler Ordering</PackageTags>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project Sdk="Microsoft.NET.Sdk">
33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<RootNamespace>NServiceBus.HandlerOrdering</RootNamespace>
66
</PropertyGroup>
77
<ItemGroup>
8-
<PackageReference Include="NServiceBus" Version="9.2.7" />
8+
<PackageReference Include="NServiceBus" Version="10.0.0" />
99
<PackageReference Include="ProjectDefaults" Version="1.0.170" PrivateAssets="all" />
1010
</ItemGroup>
1111
</Project>

src/HandlerOrdering/OrderHandlers.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,18 @@ static void ApplyInterfaceHandlerOrdering(EndpointConfiguration configuration)
1313
{
1414
var handlerDependencies = GetHandlerDependencies(configuration);
1515
var sorted = new TypeSorter(handlerDependencies).Sorted;
16-
configuration.ExecuteTheseHandlersFirst(sorted);
16+
17+
var addHandlerMethod = typeof(EndpointConfiguration).GetMethod("AddHandler", BindingFlags.Instance | BindingFlags.Public);
18+
if (addHandlerMethod == null)
19+
{
20+
throw new($"Could not find 'AddHandler' method on {nameof(EndpointConfiguration)}. Raise an issue here https://github.com/NServiceBusExtensions/NServiceBus.HandlerOrdering/issues/new");
21+
}
22+
23+
foreach (var handlerType in sorted)
24+
{
25+
var genericMethod = addHandlerMethod.MakeGenericMethod(handlerType);
26+
genericMethod.Invoke(configuration, null);
27+
}
1728
}
1829

1930
static Dictionary<Type, List<Type>> GetHandlerDependencies(EndpointConfiguration configuration)

src/Sample/Sample.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<LangVersion>7.1</LangVersion>
66
</PropertyGroup>
77
<ItemGroup>
8-
<PackageReference Include="NServiceBus" Version="9.2.7" />
8+
<PackageReference Include="NServiceBus" Version="10.0.0" />
99
<ProjectReference Include="..\HandlerOrdering\NServiceBus.Community.HandlerOrdering.csproj" />
1010
</ItemGroup>
1111
</Project>

0 commit comments

Comments
 (0)