Exemple #1
0
 public static void AddAssemblyMessageHandlers(this IServiceCollection services, Assembly assembly = null)
 {
     ForEachMessageHandlerInAssembly.Execute(
         (handlerType, handlerInterface, messageType) => services.AddScoped(handlerInterface, handlerType),
         assembly != null ? assembly : Assembly.GetCallingAssembly()
         );
 }
Exemple #2
0
 public static void AddAssemblySubscribtions(this IMessageBus bus,
                                             IServiceProvider serviceProvider, Assembly assembly = null)
 {
     ForEachMessageHandlerInAssembly.Execute(
         (handlerType, handlerInterface, messageType) =>
     {
         var handler = serviceProvider.GetService(handlerInterface);
         bus.SubscribeToMessage(messageType, handler);
     },
         assembly ?? Assembly.GetEntryAssembly()
         );
 }