Skip to content

Commit

Permalink
Extended CQRS DI interface
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonmwebb-lv committed May 2, 2024
1 parent 4bd27d1 commit d8242eb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ protected override void OnBuildInitialized()
{
Log.Information("Generating NuGet packages for projects in solution");
int commitNum = 0;
string NuGetVersionCustom = "2.0.0.875";
string NuGetVersionCustom = "2.0.0.876";


//if it's not a tagged release - append the commit number to the package version
Expand Down
15 changes: 15 additions & 0 deletions Src/RCommon.ApplicationServices/CqrsBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,27 @@ public static void AddQueryHandler<TQueryHandler, TQuery, TResult>(this ICqrsBui
builder.Services.AddTransient<IQueryHandler<TQuery, TResult>, TQueryHandler>();
}

public static void AddQuery<TQuery, TQueryHandler, TResult>(this ICqrsBuilder builder)
where TQueryHandler : class, IQueryHandler<TQuery, TResult>
where TQuery : IQuery<TResult>
{
builder.Services.AddTransient<IQueryHandler<TQuery, TResult>, TQueryHandler>();
}

public static void AddCommandHandler<TCommandHandler, TCommand, TResult>(this ICqrsBuilder builder)
where TCommandHandler : class, ICommandHandler<TResult, TCommand>
where TCommand : ICommand<TResult>
where TResult : IExecutionResult
{
builder.Services.AddTransient<ICommandHandler<TResult, TCommand>, TCommandHandler>();
}

public static void AddCommand<TCommand, TCommandHandler, TResult>(this ICqrsBuilder builder)
where TCommandHandler : class, ICommandHandler<TResult, TCommand>
where TCommand : ICommand<TResult>
where TResult : IExecutionResult
{
builder.Services.AddTransient<ICommandHandler<TResult, TCommand>, TCommandHandler>();
}
}
}

0 comments on commit d8242eb

Please sign in to comment.