Exemplo n.º 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());
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
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);
        }