private static void AddCommandsProcessing(ContainerBuilder builder, ContainerBuilderPluginRegistration pluginRegistration)
 {
     builder.RegisterType <XmlDataTypeProvider>().As <IDataTypeProvider>().SingleInstance();
     builder.RegisterType <ProcessingEngine>().As <IProcessingEngine>();
     pluginRegistration.FindAndRegisterPlugins <ICommandData>();
     pluginRegistration.FindAndRegisterPlugins <ICommandImplementation>();
     pluginRegistration.FindAndRegisterPlugins <ICommandObserver>();
     pluginRegistration.FindAndRegisterPlugins <ICommandInfo>();
 }
        private void AddSecurity(ContainerBuilder builder, ContainerBuilderPluginRegistration pluginRegistration)
        {
            builder.Register(context => context.Resolve <IConfiguration>().GetOptions <AppSecurityOptions>()).SingleInstance().PreserveExistingDefaults();
            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 <NullAuthorizationProvider>().As <IAuthorizationProvider>().PreserveExistingDefaults();

            // Cannot use FindAndRegisterPlugins on IUserInfo because each type should be manually registered with InstancePerLifetimeScope.
            pluginRegistration.FindAndRegisterPlugins <IAuthorizationProvider>();
            pluginRegistration.FindAndRegisterPlugins <IClaimProvider>();
        }
Example #3
0
 private void AddDsl(ContainerBuilder builder, ContainerBuilderPluginRegistration pluginRegistration)
 {
     builder.RegisterType <DslModel>().As <IDslModel>().SingleInstance();
     builder.RegisterType <ConceptMetadata>().SingleInstance();
     pluginRegistration.FindAndRegisterPlugins <IConceptMetadataExtension>();
     builder.RegisterType <DiskDslScriptLoader>().As <IDslScriptsProvider>().SingleInstance();
     builder.RegisterType <Tokenizer>().SingleInstance();
     builder.RegisterType <DslModelFile>().As <IDslModelFile>().SingleInstance();
     builder.RegisterType <DslParser>().As <IDslParser>();
     builder.RegisterType <MacroOrderRepository>().As <IMacroOrderRepository>();
     builder.RegisterType <InitializationConcept>().As <IConceptInfo>(); // This plugin is registered manually because FindAndRegisterPlugins does not scan core Rhetos dlls.
     pluginRegistration.FindAndRegisterPlugins <IConceptInfo>();
     pluginRegistration.FindAndRegisterPlugins <IConceptMacro>(typeof(IConceptMacro <>));
 }
 private void AddDsl(ContainerBuilder builder, ContainerBuilderPluginRegistration pluginRegistration)
 {
     builder.RegisterType <DslContainer>();
     pluginRegistration.FindAndRegisterPlugins <IDslModelIndex>();
     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.
 }
 private void AddCompiler(ContainerBuilder builder, ContainerBuilderPluginRegistration pluginRegistration)
 {
     builder.RegisterType <CodeBuilder>().As <ICodeBuilder>();
     builder.RegisterType <Compiler.CodeGenerator>().As <ICodeGenerator>();
     builder.RegisterType <SourceWriter>().As <ISourceWriter>().SingleInstance();
     pluginRegistration.FindAndRegisterPlugins <IConceptCodeGenerator>();
 }
 private void AddDsl(ContainerBuilder builder, ContainerBuilderPluginRegistration pluginRegistration)
 {
     builder.RegisterType <DslModel>().As <IDslModel>().SingleInstance();
     builder.RegisterType <ConceptMetadata>().SingleInstance();
     pluginRegistration.FindAndRegisterPlugins <IConceptMetadataExtension>();
     builder.RegisterType <DiskDslScriptLoader>().As <IDslScriptsProvider>().SingleInstance();
     builder.RegisterType <Tokenizer>().As <ITokenizer>();
     builder.RegisterType <DslParser>().As <IDslParser>();
     builder.RegisterType <DslModelFile>().As <IDslModelFile>().SingleInstance();
     builder.RegisterType <DslSyntaxFromPlugins>();
     builder.RegisterType <DslSyntaxFile>();
     builder.Register(context => context.Resolve <DslSyntaxFromPlugins>().CreateDslSyntax()).As <DslSyntax>().SingleInstance();
     builder.RegisterType <DslSyntaxFileGenerator>().As <IGenerator>();
     builder.RegisterType <DslDocumentationFile>();
     builder.RegisterType <DslDocumentationFileGenerator>().As <IGenerator>();
     builder.RegisterType <MacroOrderRepository>().As <IMacroOrderRepository>();
     builder.RegisterType <InitializationConcept>().As <IConceptInfo>(); // This plugin is registered manually because FindAndRegisterPlugins does not scan core Rhetos DLLs.
     pluginRegistration.FindAndRegisterPlugins <IConceptInfo>();
     pluginRegistration.FindAndRegisterPlugins <IConceptMacro>(typeof(IConceptMacro <>));
 }
        private void AddDatabaseGenerator(ContainerBuilder builder, ContainerBuilderPluginRegistration pluginRegistration)
        {
            // Generating database model:

            builder.RegisterType <DatabaseModelDependencies>();
            builder.RegisterType <DatabaseModelBuilder>();
            builder.RegisterType <DatabaseModelFile>();
            builder.RegisterType <DatabaseModelGenerator>().As <IGenerator>();

            // Generating data migration from SQL scripts:

            pluginRegistration.FindAndRegisterPlugins <IConceptDataMigration>(typeof(IConceptDataMigration <>));
            builder.RegisterType <DataMigrationScriptsFile>().As <IDataMigrationScriptsFile>();
            builder.RegisterType <DataMigrationScriptsGenerator>().As <IGenerator>();

            // Generating data migration from plugins:

            pluginRegistration.FindAndRegisterPlugins <IConceptDatabaseDefinition>();
            builder.RegisterType <NullImplementation>().As <IConceptDatabaseDefinition>();
            builder.RegisterType <ConceptDataMigrationGenerator>().As <IGenerator>();
        }
 private void AddPersistence(ContainerBuilder builder, ContainerBuilderPluginRegistration pluginRegistration)
 {
     builder.RegisterType <EntityFrameworkMappingGenerator>().As <IGenerator>();
     pluginRegistration.FindAndRegisterPlugins <IConceptMapping>(typeof(ConceptMapping <>));
 }
 private void AddUtilities(ContainerBuilder builder, ContainerBuilderPluginRegistration pluginRegistration)
 {
     pluginRegistration.FindAndRegisterPlugins <ILocalizer>();
     builder.RegisterType <NoLocalizer>().As <ILocalizer>().SingleInstance().PreserveExistingDefaults();
 }
 private static void AddDsl(ContainerBuilder builder, ContainerBuilderPluginRegistration pluginRegistration)
 {
     builder.RegisterType <DslModelFile>().As <IDslModel>().SingleInstance();
     builder.RegisterType <ConceptMetadata>().SingleInstance();
     pluginRegistration.FindAndRegisterPlugins <IConceptMetadataExtension>();
 }