Beispiel #1
0
        public static IDomainContainer AddCommandHandlers(
            this IDomainContainer domainContainer,
            Assembly fromAssembly,
            Predicate <Type> predicate = null)
        {
            predicate = predicate ?? (t => true);
            var commandHandlerTypes = fromAssembly
                                      .GetTypes()
                                      .Where(t => t.GetTypeInfo().GetInterfaces().Any(IsCommandHandlerInterface))
                                      .Where(t => !t.HasConstructorParameterOfType(IsCommandHandlerInterface))
                                      .Where(t => predicate(t));

            return(domainContainer.AddCommandHandlers(commandHandlerTypes));
        }
Beispiel #2
0
 public static IDomainContainer AddCommandHandlers(
     this IDomainContainer domainContainer,
     params Type[] commandHandlerTypes)
 {
     return(domainContainer.AddCommandHandlers((IEnumerable <Type>)commandHandlerTypes));
 }