Ejemplo n.º 1
0
 public IServiceCollection CreateBuilder(IServiceCollection services)
 {
     _bootstrapper = new InternalBootstrapper(_startupModuleType, services, _context.Configuration, _optionsAction);
     _bootstrapper.Properties["HostingEnvironment"] = _context.HostingEnvironment;
     services.AddSingleton(_bootstrapper);
     return(services);
 }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="startupModuleType"></param>
        /// <param name="optionsAction"></param>
        /// <returns></returns>
        public static IBootstrapper AddBootstrapper(this IHostBuilder builder, Type startupModuleType, Action <BootstrapperCreationOptions> optionsAction)
        {
            InternalBootstrapper bootstrapper = null;

            builder.ConfigureServices((context, services) =>
            {
                bootstrapper = new InternalBootstrapper(startupModuleType, services, context.Configuration, optionsAction);
                bootstrapper.Properties["HostingEnvironment"] = context.HostingEnvironment;
                services.AddSingleton(bootstrapper);
            });
            builder.UseServiceProviderFactory(new DynamicProxyServiceProviderFactory());
            return(bootstrapper);
        }
Ejemplo n.º 3
0
        protected IntegratedTest()
        {
            var services = CreateServiceCollection();

            BeforeAddBootstrapper(services);

            var bootstrapper = new InternalBootstrapper(typeof(TStartupModule), services, null, SetBootstrapperCreationOptions);

            Bootstrapper = bootstrapper;

            AfterAddBootstrapper(services);

            RootServiceProvider = CreateServiceProvider(services);
            TestServiceScope    = RootServiceProvider.CreateScope();
            bootstrapper.SetServiceProvider(TestServiceScope.ServiceProvider);
            bootstrapper.Initialize();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Constructor
        /// </summary>
        protected Manager()
        {
            ConcurrentBag <Assembly> LoadedAssemblies = LoadAssemblies();
            List <Type> LoadedTypes   = GetTypes(ref LoadedAssemblies);
            List <Type> Bootstrappers = LoadedTypes.Where(x => x.GetInterfaces().Contains(typeof(IBootstrapper)) &&
                                                          x.IsClass &&
                                                          !x.IsAbstract &&
                                                          !x.ContainsGenericParameters &&
                                                          !x.Namespace.StartsWith("UTILITIES", StringComparison.OrdinalIgnoreCase))
                                        .ToList();

            if (Bootstrappers.Count == 0)
            {
                Bootstrappers.Add(typeof(DefaultBootstrapper));
            }
            InternalBootstrapper = (IBootstrapper)Activator.CreateInstance(Bootstrappers[0], LoadedAssemblies, LoadedTypes);
            InternalBootstrapper.RegisterAll <IModule>();
            foreach (IModule Module in InternalBootstrapper.ResolveAll <IModule>().OrderBy(x => x.Order))
            {
                Module.Load(InternalBootstrapper);
            }
        }
Ejemplo n.º 5
0
 public override void ConfigureServices(IServiceCollection services)
 {
     _bootstrapper = new InternalBootstrapper(_startuModuleType, services, _context.Configuration, _optionsAction);
     _bootstrapper.Properties["HostingEnvironment"] = _context.HostingEnvironment;
     services.AddSingleton(_bootstrapper);
 }