示例#1
0
        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");
        }
示例#2
0
        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));
        }
示例#3
0
        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);
        }
示例#4
0
 /// <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);
 }