|
|
@ -42,4 +42,12 @@ public static class ServiceCollectionExtensions
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return services;
|
|
|
|
return services;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void SubscribeEvent<TEvent, TEvenHandler>(this IServiceProvider services)
|
|
|
|
|
|
|
|
where TEvent : IntegrationEvent where TEvenHandler : IIntegrationEventHandler<TEvent>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ArgumentNullException.ThrowIfNull(services);
|
|
|
|
|
|
|
|
var eventBus = services.GetRequiredService<IEventBus>();
|
|
|
|
|
|
|
|
eventBus.Subscribe<TEvent, TEvenHandler>();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|