diff --git a/samples/CommandProcessor/HelloWorldAsync/GreetingCommandRequestHandlerAsync.cs b/samples/CommandProcessor/HelloWorldAsync/GreetingCommandRequestHandlerAsync.cs index 2f46a55dd8..cab4bc0f03 100644 --- a/samples/CommandProcessor/HelloWorldAsync/GreetingCommandRequestHandlerAsync.cs +++ b/samples/CommandProcessor/HelloWorldAsync/GreetingCommandRequestHandlerAsync.cs @@ -36,7 +36,7 @@ internal class GreetingCommandRequestHandlerAsync : RequestHandlerAsync HandleAsync(GreetingCommand command, CancellationToken cancellationToken = default) { - Console.WriteLine("Hello {0}}", command.Name); + Console.WriteLine("Hello {0}", command.Name); return await base.HandleAsync(command, cancellationToken).ConfigureAwait(ContinueOnCapturedContext); } diff --git a/samples/CommandProcessor/HelloWorldInternalBus/GreetingCommandHandler.cs b/samples/CommandProcessor/HelloWorldInternalBus/GreetingCommandHandler.cs index 4c7349a018..fdc92e224f 100644 --- a/samples/CommandProcessor/HelloWorldInternalBus/GreetingCommandHandler.cs +++ b/samples/CommandProcessor/HelloWorldInternalBus/GreetingCommandHandler.cs @@ -1,4 +1,4 @@ -#region Licence +#region Licence /* The MIT License (MIT) Copyright © 2015 Ian Cooper @@ -29,13 +29,13 @@ THE SOFTWARE. */ namespace HelloWorld { - internal class GreetingCommandHandler : RequestHandler + internal class GreetingCommandHandler : RequestHandlerAsync { - [RequestLogging(step: 1, timing: HandlerTiming.Before)] - public override GreetingCommand Handle(GreetingCommand command) + [RequestLoggingAsync(step: 1, timing: HandlerTiming.Before)] + public override async Task HandleAsync(GreetingCommand command, CancellationToken cancellationToken) { Console.WriteLine("Hello {0}", command.Name); - return base.Handle(command); + return await base.HandleAsync(command, cancellationToken); } } } diff --git a/src/Paramore.Brighter/RequestHandlerAsync.cs b/src/Paramore.Brighter/RequestHandlerAsync.cs index 287dcb7449..e8aa9934a5 100644 --- a/src/Paramore.Brighter/RequestHandlerAsync.cs +++ b/src/Paramore.Brighter/RequestHandlerAsync.cs @@ -83,6 +83,9 @@ public abstract class RequestHandlerAsync : IHandleRequestsAsyncThe successor. public void SetSuccessor(IHandleRequestsAsync successor) { + if (this == successor) + return; + _successor = successor; }