/// <summary> /// Setup the Engine registrations in the DI container. This method will not scan /// for handler classes in your solution, you must have them registered already /// before calling this method. /// </summary> /// <typeparam name="TEnvironment"></typeparam> /// <param name="services"></param> /// <param name="build"></param> /// <param name="getProvider"></param> /// <returns></returns> public static IServiceCollection SetupEngineScannerless <TEnvironment>(this IServiceCollection services, Action <IEngineBuilder> build, Func <IServiceProvider> getProvider) where TEnvironment : class { // Setup a custom resolver for manually-specified types, and use that in the // buildup var handlersBuilder = new HandlerSetup(); var builder = new EngineBuilder(handlers: handlersBuilder); build?.Invoke(builder); EngineBuilder.SetupEngineRegistrations(services); EngineBuilder.SetupExplicitEnvironmentRegistration <TEnvironment>(services); // Setup a Handler Source to resolve handler instances from the provider var registeredHandlerSource = new MicrosoftRegisteredHandlerSource(services, getProvider, TypeVerbExtractor.DefaultInstance); handlersBuilder.AddSource(registeredHandlerSource); // Build up the final Engine registrations. This involves resolving some // dependencies which were setup previously builder.BuildUp(services); return(services); }