public void PostConfigureServices() { var services = new ServiceCollection(); var options = new BootstrapperCreationOptions(); options.PostConfigureServices(c => c.Properties.Add("test", "value")); var context = new ConfigureServicesContext(null, services, null); context.Properties.ShouldBeEmpty(); options.PostConfigureServices(context); context.Properties.ShouldHaveSingleItem().Key.ShouldBe("test"); }
private void ConfigureServices() { var context = new ConfigureServicesContext(this, Services, Configuration); Services.AddSingleton(context); _options.PreConfigureServices(context); Modules.ForEach(m => m.Instance.PreConfigureServices(context)); _options.ConfigureServices(context); Modules.ForEach(m => m.Instance.ConfigureServices(context)); _options.PostConfigureServices(context); Modules.ForEach(m => m.Instance.PostConfigureServices(context)); }
private void ConfigureServices() { var context = new ConfigureServicesContext(this, Services, Configuration); Services.AddSingleton(context); Modules.ForEach(m => m.Instance.PreConfigureServices(context)); _options.PreConfigureServices(context); Modules.ForEach(m => { if (m.Instance is ScorpioModule module && !module.SkipAutoServiceRegistration) { Services.RegisterAssemblyByConvention(m.Type.Assembly); } m.Instance.ConfigureServices(context); }); _options.ConfigureServices(context); Modules.ForEach(m => m.Instance.PostConfigureServices(context)); _options.PostConfigureServices(context); }
/// <summary> /// /// </summary> /// <param name="options"></param> /// <returns></returns> public static BootstrapperCreationOptions UseAspectCore(this BootstrapperCreationOptions options) { options.UseServiceProviderFactory(new AspectCore.Extensions.DependencyInjection.ServiceContextProviderFactory()); options.PostConfigureServices(context => DynamicProxy.InterceptorHelper.RegisterConventionalInterceptor(context.Services)); return(options); }