public static IEventFlowOptions AddCommandHandlers( this IEventFlowOptions eventFlowOptions, Assembly fromAssembly, Predicate <Type> predicate = null) { predicate = predicate ?? (t => true); var commandHandlerTypes = fromAssembly .GetTypes() .Where(t => t.GetInterfaces().Any(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(ICommandHandler <, , ,>))) .Where(t => predicate(t)); return(eventFlowOptions.AddCommandHandlers(commandHandlerTypes)); }
public static IEventFlowOptions AddCommandHandlers( this IEventFlowOptions eventFlowOptions, 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(eventFlowOptions.AddCommandHandlers(commandHandlerTypes)); }
public static IEventFlowOptions AddCommandHandlers( this IEventFlowOptions eventFlowOptions, params Type[] commandHandlerTypes) { return(eventFlowOptions.AddCommandHandlers((IEnumerable <Type>)commandHandlerTypes)); }
private void RegisterCommandHandlers(IEventFlowOptions eventFlowOptions) { eventFlowOptions.AddCommandHandlers(typeof(CreateTestHandler)); }