Skip to content

Commit

Permalink
FIxed side effect handler registration (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
fraliv13 authored Aug 5, 2020
1 parent 4077c4c commit 57c40db
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Core/NBB.Core.Effects/DependencyInjectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static IServiceCollection AddSideEffectHandler<TOutput>(this IServiceColl
public static IServiceCollection AddSideEffectHandler<TSideEffect, TOutput>(this IServiceCollection services, Func<TSideEffect, CancellationToken, Task<TOutput>> handlerFn)
where TSideEffect : ISideEffect<TOutput>
{
services.AddSingleton(new GenericSideEffectHandler<TSideEffect, TOutput>(handlerFn));
services.AddSingleton<ISideEffectHandler<TSideEffect, TOutput>>(new GenericSideEffectHandler<TSideEffect, TOutput>(handlerFn));
return services;
}

Expand All @@ -35,7 +35,7 @@ Task<TOutput> HandlerFnAsync(TSideEffect sideEffect, CancellationToken _cancella
return Task.FromResult(handlerFn(sideEffect));
}

services.AddSingleton(new GenericSideEffectHandler<TSideEffect, TOutput>(HandlerFnAsync));
services.AddSingleton<ISideEffectHandler<TSideEffect, TOutput>>(new GenericSideEffectHandler<TSideEffect, TOutput>(HandlerFnAsync));
return services;
}
}
Expand Down

0 comments on commit 57c40db

Please sign in to comment.