Skip to content

Commit

Permalink
Updates to DI and examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonMWebb committed Mar 9, 2024
1 parent 518eee6 commit 2d515a7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 0 additions & 2 deletions Examples/Examples.sln
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Examples.EventHandling.Medi
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CQRS", "CQRS", "{783F8A99-F164-42E3-BD7C-09D432D02DEE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CQRS", "CQRS", "{D724588A-9236-4175-A337-53C4530CC5A7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Experimental", "Experimental", "{6509FEEC-F46C-4B03-82D4-8F2D78896160}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Examples.EventHandling.InMemoryEventBus", "EventHandling\Examples.EventHandling.InMemoryEventBus\Examples.EventHandling.InMemoryEventBus.csproj", "{86CE6DBE-418E-440B-9C27-58B00AFB2FCA}"
Expand Down
3 changes: 3 additions & 0 deletions Src/RCommon.EventHandling/EventHandlingBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public static IRCommonBuilder WithEventHandling<T>(this IRCommonBuilder builder,
// Event Bus
builder.Services.AddSingleton<IEventBus, InMemoryEventBus>();

// Event Routing
builder.Services.AddTransient<IEventRouter, EventRouter>();

// Event Handling Configurations
var eventHandlingConfig = (T)Activator.CreateInstance(typeof(T), new object[] { builder });
actions(eventHandlingConfig);
Expand Down
4 changes: 4 additions & 0 deletions Src/RCommon.Persistence/PersistenceBuilderExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
using Microsoft.Extensions.DependencyInjection;
using RCommon.Entities;
using RCommon.EventHandling;
using RCommon.EventHandling.Producers;
using RCommon.Persistence;
using RCommon.Persistence.Transactions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

Expand Down Expand Up @@ -65,6 +68,7 @@ public static IRCommonBuilder WithPersistence<TObjectAccess, TUnitOfWork>(this I
/// <returns>Updated instance of <see cref="IRCommonBuilder"/>RCommon Configuration</returns>
private static IRCommonBuilder WithChangeTracking(this IRCommonBuilder config)
{
config.Services.AddTransient<IEventRouter, EventRouter>();
config.Services.AddScoped<IEventTracker, InMemoryEventTracker>();
return config;
}
Expand Down

0 comments on commit 2d515a7

Please sign in to comment.