Ejemplo n.º 1
0
 private void RegisterCommandHandlers(IEnumerable <Type> commandHandlerTypes)
 {
     foreach (Type commandHandlerType in commandHandlerTypes)
     {
         CommandBindExtensions
         .BindCommandHandler(kernel, commandHandlerType)
         .InTaskScope();
     }
 }
Ejemplo n.º 2
0
        private void DiscoverCommandHandlers()
        {
            var commandHandlerTypes = typeExplorer.GetAllTypes()
                                      .Where(x => x.IsClass && !x.IsAbstract && !x.IsGenericTypeDefinition &&
                                             CommandBindExtensions.GetCommandHandlerInterfaces(x).Length > 0)
                                      .ToArray();

            RegisterCommandHandlers(commandHandlerTypes);
            Logger.Debug($"Discovered {commandHandlerTypes.Length} command handlers: {string.Join(", ", commandHandlerTypes.Select(x => x.FullName))}");
        }