All checks were successful
default / dotnet-default-workflow (push) Successful in 1m58s
Pipeline behavior ordering previously depended on discovery/registration order. Add an AddBehavior<T>(order:) API that captures the order at registration time; the BehaviorTypeIndex now orders matching behaviors by that explicit order (lower runs first), falling back to registration order for ties. Removed the runtime Order property approach.
22 lines
809 B
C#
22 lines
809 B
C#
// Copyright (c) The Geekeey Authors
|
|
// SPDX-License-Identifier: EUPL-1.2
|
|
|
|
namespace Geekeey.Request.Dispatcher.Tests;
|
|
|
|
public class OrderedScalarBehaviorA(ScalarTestTracker tracker) : IScalarRequestBehavior<ScalarTestRequest, string>
|
|
{
|
|
public async Task<string> HandleAsync(ScalarTestRequest request, ScalarHandlerDelegate<string> next, CancellationToken cancellationToken)
|
|
{
|
|
tracker.Log.Add("OrderedA");
|
|
return await next(request, cancellationToken);
|
|
}
|
|
}
|
|
|
|
public class OrderedScalarBehaviorB(ScalarTestTracker tracker) : IScalarRequestBehavior<ScalarTestRequest, string>
|
|
{
|
|
public async Task<string> HandleAsync(ScalarTestRequest request, ScalarHandlerDelegate<string> next, CancellationToken cancellationToken)
|
|
{
|
|
tracker.Log.Add("OrderedB");
|
|
return await next(request, cancellationToken);
|
|
}
|
|
}
|