Skip to content

Commit

Permalink
Minor changes to DI API to allow better chaining and fix for UnitOfWo…
Browse files Browse the repository at this point in the history
…rk Scope
  • Loading branch information
jasonmwebb-lv committed Apr 23, 2024
1 parent aaabf5c commit c4530e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Src/RCommon.ApplicationServices/CqrsBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ namespace RCommon
{
public static class CqrsBuilderExtensions
{
public static ICqrsBuilder WithCQRS<T>(this IRCommonBuilder builder)
public static IRCommonBuilder WithCQRS<T>(this IRCommonBuilder builder)
where T : ICqrsBuilder
{

return WithCQRS<T>(builder, x => { });
}

public static ICqrsBuilder WithCQRS<T>(this IRCommonBuilder builder, Action<T> actions)
public static IRCommonBuilder WithCQRS<T>(this IRCommonBuilder builder, Action<T> actions)
where T : ICqrsBuilder
{

// Event Handling Configurations
var cqrsBuilder = (T)Activator.CreateInstance(typeof(T), new object[] { builder });
actions(cqrsBuilder);
return cqrsBuilder;
return builder;
}

public static void AddQueryHandler<TQueryHandler, TQuery, TResult>(this ICqrsBuilder builder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public DefaultUnitOfWorkBuilder(IServiceCollection services)
services.AddScoped<IUnitOfWorkManager, UnitOfWorkScopeManager>();

// Factory for Unit Of Work Scope
services.AddScoped<IUnitOfWork, UnitOfWorkScope>();
services.AddScoped<IUnitOfWorkFactory, UnitOfWorkFactory>();
services.AddTransient<IUnitOfWork, UnitOfWorkScope>();
services.AddTransient<IUnitOfWorkFactory, UnitOfWorkFactory>();
_services = services;
}

Expand Down

0 comments on commit c4530e0

Please sign in to comment.