Ejemplo n.º 1
0
        public static void AddNakedFramework(this IServiceCollection services, Action <NakedCoreOptions> setupAction)
        {
            var options = new NakedCoreOptions(services);

            setupAction(options);

            services.AddNakedCoreFramework(options);
        }
Ejemplo n.º 2
0
        public static CoreConfiguration CoreConfig(NakedCoreOptions options)
        {
            var config = new CoreConfiguration(options.MainMenus);

            if (options.SupportedSystemTypes is not null)
            {
                config.SupportedSystemTypes = options.SupportedSystemTypes(config.SupportedSystemTypes.ToArray()).ToList();
            }

            return(config);
        }
Ejemplo n.º 3
0
        public static void AddEntityPersistor(this NakedCoreOptions coreOptions, Action <EntityPersistorOptions> setupAction)
        {
            var options = new EntityPersistorOptions();

            setupAction(options);

            coreOptions.Services.AddSingleton <IEntityObjectStoreConfiguration>(p => EntityObjectStoreConfiguration(p.GetService <IConfiguration>(), options));
            coreOptions.Services.AddScoped <EntityOidGenerator, EntityOidGenerator>();
            coreOptions.Services.AddScoped <IOidGenerator, EntityOidGenerator>();
            coreOptions.Services.AddScoped <IObjectStore, EntityObjectStore>();
        }
Ejemplo n.º 4
0
        private static void AddNakedCoreFramework(this IServiceCollection services, NakedCoreOptions options)
        {
            ParallelConfig.RegisterCoreSingletonTypes(services);
            ParallelConfig.RegisterCoreScopedTypes(services);

            if (options.AuthorizationConfiguration is not null)
            {
                services.AddSingleton(options.AuthorizationConfiguration);
                services.AddSingleton <IFacetDecorator, AuthorizationManager>();
            }

            if (options.AuditConfiguration is not null)
            {
                services.AddSingleton(options.AuditConfiguration);
                services.AddSingleton <IFacetDecorator, AuditManager>();
            }

            if (options.ProfileConfiguration is not null)
            {
                services.AddSingleton(options.ProfileConfiguration);
                services.AddSingleton <IFacetDecorator, ProfileManager>();
            }


            services.AddSingleton <ICoreConfiguration>(p => CoreConfig(options));


            // frameworkFacade
            services.AddTransient <IOidTranslator, OidTranslatorSlashSeparatedTypeAndIds>();
            services.AddTransient <IOidStrategy, EntityOidStrategy>();
            services.AddTransient <IStringHasher, InvariantStringHasher>();
            services.AddTransient <IFrameworkFacade, FrameworkFacade>();

            //Externals
            services.AddScoped <IPrincipal>(p => p.GetService <IHttpContextAccessor>().HttpContext.User);
        }