/// <summary> /// Gets a configuration to apply to all events types passed as parameters. /// </summary> /// <param name="eventTypes">Types of event to configure.</param> /// <returns>Mutilple event type configuration</returns> public MultipleEventTypeConfiguration ForEvents(params Type[] eventTypes) { var config = new MultipleEventTypeConfiguration(eventTypes.ToArray()); _multipleEventConfigs.Add(config); return(config); }
/// <summary> /// Gets a configuration to apply to all events types from a single assemlby. /// </summary> /// <param name="assembly">assembly to use to get all events types</param> /// <returns>Multiple event type configuration.</returns> public MultipleEventTypeConfiguration ForEventsInAssembly(Assembly assembly) { if (assembly == null) { throw new ArgumentNullException(nameof(assembly)); } Type[] types = new Type[0]; try { types = assembly.GetTypes(); } catch (ReflectionTypeLoadException e) { types = e.Types.WhereNotNull().ToArray(); } types = types.Where(IsEventTypeAndNotAlreadyDefined).ToArray(); var config = new MultipleEventTypeConfiguration(types); _multipleEventConfigs.Add(config); return(config); }