/// <summary> /// Registers all request handlers. /// </summary> /// <param name="serviceRegistrar"> The service registrar. </param> /// <param name="registrationScope"> The registration scope. </param> /// <param name="assembliesToScan"> The assemblies to scan. </param> /// <returns> </returns> public static IServiceRegistrar RegisterAllRequestHandlers(this IServiceRegistrar serviceRegistrar, RegistrationScope registrationScope, IEnumerable <Assembly> assembliesToScan) { assembliesToScan = (assembliesToScan as Assembly[] ?? assembliesToScan).Distinct().ToArray(); registrationScope = RegistrationScope.Singleton.Restricted(registrationScope); return(serviceRegistrar .ConnectImplementationsToTypesClosing(registrationScope, typeof(IRequestHandler <,>), assembliesToScan, false)); }