Example #1
0
        public IContainer BuildContainer(ILogProvider logProvider, IConfiguration configuration, Action <ContainerBuilder> registerCustomComponents)
        {
            var pluginAssemblies = AssemblyResolver.GetRuntimeAssemblies(configuration);
            var builder          = new RhetosContainerBuilder(configuration, logProvider, pluginAssemblies);

            builder.AddRhetosRuntime();

            if (_isHost)
            {
                // WCF-specific component registrations.
                // Can be customized later by plugin modules.
                builder.RegisterType <WcfWindowsUserInfo>().As <IUserInfo>().InstancePerLifetimeScope();
                builder.RegisterType <RhetosService>().As <RhetosService>().As <IServerApplication>();
                builder.RegisterType <Rhetos.Web.GlobalErrorHandler>();
                builder.RegisterType <WebServices>();
                builder.GetPluginRegistration().FindAndRegisterPlugins <IService>();
            }

            builder.AddPluginModules();

            if (_isHost)
            {
                // HomePageServiceInitializer must be register after other core services and plugins to allow routing overrides.
                builder.RegisterType <HomePageService>().InstancePerLifetimeScope();
                builder.RegisterType <HomePageServiceInitializer>().As <IService>();
                builder.GetPluginRegistration().FindAndRegisterPlugins <IHomePageSnippet>();
            }

            registerCustomComponents?.Invoke(builder);

            return(builder.Build());
        }
        internal RhetosContainerBuilder CreateDbUpdateComponentsContainer()
        {
            var builder = new RhetosContainerBuilder(_configuration, _logProvider, AssemblyResolver.GetRuntimeAssemblies(_configuration));

            builder.RegisterModule(new CoreModule());
            builder.RegisterModule(new DbUpdateModule());
            builder.AddPluginModules();
            builder.RegisterType <NullUserInfo>().As <IUserInfo>(); // Override runtime IUserInfo plugins. This container should not execute the application's business features.
            return(builder);
        }
        private IContainer BuildContainer(IConfiguration configuration)
        {
            var pluginScanner = new RuntimePluginScanner(_pluginAssemblies, _pluginTypes, _builderLogProvider);
            var builder       = RhetosContainerBuilder.Create(configuration, _builderLogProvider, pluginScanner);

            var configurationAction = _customContainerConfigurationAction ?? DefaultContainerConfiguration;

            configurationAction(configuration, builder, _configureContainerActions);

            return(builder.Build());
        }
Example #4
0
        internal RhetosContainerBuilder CreateBuildComponentsContainer()
        {
            var builder = new RhetosContainerBuilder(_configuration, _logProvider, _pluginAssemblies);

            builder.RegisterModule(new CoreModule());
            builder.RegisterModule(new CorePluginsModule());
            builder.RegisterModule(new BuildModule());
            builder.AddPluginModules();
            builder.RegisterType <NullUserInfo>().As <IUserInfo>(); // Override runtime IUserInfo plugins. This container should not execute the application's business features.
#pragma warning disable CS0618                                      // Registering obsolete IInstalledPackages for backward compatibility.
            builder.RegisterInstance(_installedPackages).As <IInstalledPackages>().As <InstalledPackages>();
#pragma warning restore CS0618
            return(builder);
        }
        private ContainerBuilder CreateBuildComponentsContainer()
        {
            var pluginScanner = new PluginScanner(
                _pluginAssemblies,
                _configuration.GetOptions <RhetosBuildEnvironment>(),
                _logProvider,
                _configuration.GetOptions <PluginScannerOptions>());

            var builder = RhetosContainerBuilder.Create(_configuration, _logProvider, pluginScanner);

            builder.Register(context => new PluginInfoCollection(pluginScanner.FindAllPlugins()));
            builder.RegisterModule(new CoreModule());
            builder.RegisterModule(new CorePluginsModule());
            builder.RegisterModule(new BuildModule());
            builder.AddRhetosPluginModules();
            builder.RegisterType <NullUserInfo>().As <IUserInfo>(); // Override runtime IUserInfo plugins. This container should not execute the application's business features.
            builder.RegisterInstance(_installedPackages);
            return(builder);
        }