Exemplo n.º 1
0
        public static void UseAutofac(this RocketApplicationCreationOptions options)
        {
            var builder = new ContainerBuilder();

            options.Services.AddObjectAccessor(builder);
            options.Services.AddSingleton((IServiceProviderFactory <ContainerBuilder>) new RocketAutofacServiceProviderFactory(builder));
        }
Exemplo n.º 2
0
        internal RocketApplicationBase(
            [NotNull] Type startupModuleType, [NotNull] IServiceCollection services, [CanBeNull] Action <RocketApplicationCreationOptions> optionsAction)
        {
            Check.NotNull(startupModuleType, nameof(startupModuleType));
            Check.NotNull(services, nameof(services));

            StartupModuleType = startupModuleType;
            Services          = services;

            services.TryAddObjectAccessor <IServiceProvider> ();

            var options = new RocketApplicationCreationOptions(services);

            optionsAction?.Invoke(options);

            services.AddSingleton <IRocketApplication> (this);
            services.AddSingleton <IModuleContainer> (this);

            services.AddCoreServices();
            services.AddCoreRocketServices(this, options);

            Modules = LoadModules(services, options);
        }
Exemplo n.º 3
0
 private IReadOnlyList <IRocketModuleDescriptor> LoadModules(IServiceCollection services, RocketApplicationCreationOptions options)
 {
     return(services
            .GetSingletonInstance <IModuleLoader> ()
            .LoadModules(
                services,
                StartupModuleType,
                options.PlugInSources
                ));
 }