Example #1
0
        public static IServiceCollection AddInfrastructure(this IServiceCollection services,
                                                           Func <IServiceProvider, InfrastructureConfig> infrastructureConfigFactory,
                                                           ILoggerProvider efContextLoggerProvider            = null,
                                                           IConfigureEntityFramework configureEntityFramework = null,
                                                           bool useAuditoria = false)
        {
            var repositoriesImplemented = GetRepositoriesImplemented();

            services = services
                       .AddSingleton(infrastructureConfigFactory)
                       .AddEntityFramework(configureEntityFramework, efContextLoggerProvider, useAuditoria)
                       .AddInfrastructureRepositories(repositoriesImplemented)
                       .AddReadOnlyRepositories(repositoriesImplemented)
                       .AddEmailServices()
                       .AddCudOperationFactory()
                       .AddHttpClients();

            return(services);
        }
Example #2
0
        public static IServiceCollection AddEntityFramework(this IServiceCollection services, IConfigureEntityFramework configureEntityFramework, ILoggerProvider efContextLoggerProvider,
                                                            bool useAuditoria)
        {
            LoggerFactory loggerFactory = null;

            if (efContextLoggerProvider != null)
            {
                loggerFactory = new LoggerFactory();
                loggerFactory.AddProvider(efContextLoggerProvider);
            }


            configureEntityFramework = configureEntityFramework ?? new ConfigureEntityFramework();
            configureEntityFramework.Configure(services, loggerFactory);

            return(services);
        }