protected override void Load(ContainerBuilder builder) { bool shortTransaction = _configurationArguments.ShortTransactions; bool deployDatabaseOnly = _configurationArguments.DeployDatabaseOnly; // Specific registrations and initialization: Plugins.SetInitializationLogging(DeploymentUtility.InitializationLogProvider); if (_deploymentTime) { builder.RegisterModule(new DatabaseGeneratorModuleConfiguration(shortTransaction)); builder.RegisterType <DataMigration>(); builder.RegisterType <DatabaseCleaner>(); builder.RegisterType <ApplicationGenerator>(); Plugins.FindAndRegisterPlugins <IGenerator>(builder); } else { builder.RegisterType <ApplicationInitialization>(); builder.RegisterInstance(_configurationArguments).As <DeployArguments>(); Plugins.FindAndRegisterPlugins <IServerInitializer>(builder); } // General registrations: builder.RegisterModule(new Rhetos.Configuration.Autofac.DefaultAutofacConfiguration(_deploymentTime, deployDatabaseOnly)); // Specific registrations override: builder.RegisterType <ProcessUserInfo>().As <IUserInfo>(); builder.RegisterInstance(DeploymentUtility.InitializationLogProvider).As <ILogProvider>(); // InitializationLogProvider allows overriding deployment logging (both within and outside IoC). base.Load(builder); }
protected override void Load(ContainerBuilder builder) { builder.RegisterType <XmlUtility>().SingleInstance(); builder.RegisterType <FilesUtility>().SingleInstance(); builder.RegisterType <Rhetos.Utilities.Configuration>().As <Rhetos.Utilities.IConfiguration>().SingleInstance(); Plugins.FindAndRegisterPlugins <ILocalizer>(builder); builder.RegisterType <NoLocalizer>().As <ILocalizer>().SingleInstance().PreserveExistingDefaults(); builder.RegisterType <GeneratedFilesCache>().SingleInstance(); var sqlImplementations = new[] { new { Dialect = "MsSql", SqlExecuter = typeof(MsSqlExecuter), SqlUtility = typeof(MsSqlUtility) }, new { Dialect = "Oracle", SqlExecuter = typeof(OracleSqlExecuter), SqlUtility = typeof(OracleSqlUtility) }, }.ToDictionary(imp => imp.Dialect); var sqlImplementation = sqlImplementations.GetValue(SqlUtility.DatabaseLanguage, () => "Unsupported database language '" + SqlUtility.DatabaseLanguage + "'. Supported languages are: " + string.Join(", ", sqlImplementations.Keys) + "."); builder.RegisterType(sqlImplementation.SqlExecuter).As <ISqlExecuter>().InstancePerLifetimeScope(); builder.RegisterType(sqlImplementation.SqlUtility).As <ISqlUtility>().InstancePerLifetimeScope(); builder.RegisterType <SqlTransactionBatches>().InstancePerLifetimeScope(); base.Load(builder); }
protected override void Load(ContainerBuilder builder) { if (_deploymentTime) { builder.RegisterType <DiskDslScriptLoader>().As <IDslScriptsProvider>().SingleInstance(); builder.RegisterType <Tokenizer>().SingleInstance(); builder.RegisterType <DslModel>().As <IDslModel>().SingleInstance(); builder.RegisterType <DslModelFile>().As <IDslModelFile>().SingleInstance(); builder.RegisterType <DslParser>().As <IDslParser>(); builder.RegisterType <MacroOrderRepository>().As <IMacroOrderRepository>(); builder.RegisterType <ConceptMetadata>().SingleInstance(); builder.RegisterType <InitializationConcept>().As <IConceptInfo>(); // This plugin is registered manually because FindAndRegisterPlugins does not scan core Rhetos dlls. Plugins.FindAndRegisterPlugins <IConceptInfo>(builder); Plugins.FindAndRegisterPlugins <IConceptMacro>(builder, typeof(IConceptMacro <>)); } else { builder.RegisterType <DslModelFile>().As <IDslModel>().SingleInstance(); } builder.RegisterType <DslContainer>(); Plugins.FindAndRegisterPlugins <IDslModelIndex>(builder); builder.RegisterType <DslModelIndexByType>().As <IDslModelIndex>(); // This plugin is registered manually because FindAndRegisterPlugins does not scan core Rhetos dlls. builder.RegisterType <DslModelIndexByReference>().As <IDslModelIndex>(); // This plugin is registered manually because FindAndRegisterPlugins does not scan core Rhetos dlls. base.Load(builder); }
protected override void Load(ContainerBuilder builder) { builder.RegisterType <AuthenticationService>().InstancePerLifetimeScope(); Plugins.CheckOverride <IUserInfo, AspNetUserInfo>(builder, typeof(WcfWindowsUserInfo)); builder.RegisterType <AspNetUserInfo>().As <IUserInfo>().InstancePerLifetimeScope(); Plugins.FindAndRegisterPlugins <ISendPasswordResetToken>(builder); base.Load(builder); }
protected override void Load(ContainerBuilder builder) { if (_deploymentTime) { builder.RegisterType <CodeBuilder>().As <ICodeBuilder>(); builder.RegisterType <CodeGenerator>().As <ICodeGenerator>(); builder.RegisterType <AssemblyGenerator>().As <IAssemblyGenerator>(); Plugins.FindAndRegisterPlugins <IConceptCodeGenerator>(builder); } base.Load(builder); }
protected override void Load(ContainerBuilder builder) { builder.RegisterType <ConceptApplicationRepository>().As <IConceptApplicationRepository>(); builder.RegisterType <DatabaseGenerator.DatabaseGenerator>().As <IDatabaseGenerator>(); builder.RegisterInstance(new DatabaseGeneratorOptions { ShortTransactions = _shortTransactions }); Plugins.FindAndRegisterPlugins <IConceptDatabaseDefinition>(builder); builder.RegisterType <NullImplementation>().As <IConceptDatabaseDefinition>(); base.Load(builder); }
protected override void Load(ContainerBuilder builder) { if (_deploymentTime) { builder.RegisterType <EntityFrameworkMappingGenerator>().As <IGenerator>(); Plugins.FindAndRegisterPlugins <IConceptMapping>(builder, typeof(ConceptMapping <>)); } else { builder.RegisterType <PersistenceTransaction>().As <IPersistenceTransaction>().InstancePerLifetimeScope(); } base.Load(builder); }
protected override void Load(ContainerBuilder builder) { // Specific registrations and initialization: Plugins.SetInitializationLogging(new NLogProvider()); builder.RegisterType <RhetosService>().As <RhetosService>().As <IServerApplication>(); builder.RegisterType <Rhetos.Web.GlobalErrorHandler>(); Plugins.FindAndRegisterPlugins <IService>(builder); Plugins.FindAndRegisterPlugins <IHomePageSnippet>(builder); // General registrations: builder.RegisterModule(new Rhetos.Configuration.Autofac.DefaultAutofacConfiguration(deploymentTime: false)); base.Load(builder); }
protected override void Load(ContainerBuilder builder) { if (!_deploymentTime) { builder.RegisterType <XmlDataTypeProvider>().As <IDataTypeProvider>().SingleInstance(); builder.RegisterType <ProcessingEngine>().As <IProcessingEngine>(); Plugins.FindAndRegisterPlugins <ICommandData>(builder); Plugins.FindAndRegisterPlugins <ICommandImplementation>(builder); Plugins.FindAndRegisterPlugins <ICommandObserver>(builder); Plugins.FindAndRegisterPlugins <ICommandInfo>(builder); } base.Load(builder); }
protected override void Load(ContainerBuilder builder) { builder.RegisterType <WindowsSecurity>().As <IWindowsSecurity>().SingleInstance(); builder.RegisterType <AuthorizationManager>().As <IAuthorizationManager>().InstancePerLifetimeScope(); // Default user authentication and authorization components. Custom plugins may override it by registering their own interface implementations. builder.RegisterType <WcfWindowsUserInfo>().As <IUserInfo>().InstancePerLifetimeScope().PreserveExistingDefaults(); builder.RegisterType <NullAuthorizationProvider>().As <IAuthorizationProvider>().PreserveExistingDefaults(); // Cannot use FindAndRegisterPlugins on IUserInfo because each type should be manually registered with InstancePerLifetimeScope. Plugins.FindAndRegisterPlugins <IAuthorizationProvider>(builder); Plugins.FindAndRegisterPlugins <IClaimProvider>(builder); base.Load(builder); }