Exemplo n.º 1
0
        public static IServiceCollection AddGecipaCoreBusinessQueries(this IServiceCollection services, CoreBusinessSqlConfiguration coreBusinessSqlConfiguration)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }

            services.AddSingleton(coreBusinessSqlConfiguration ?? throw new ArgumentNullException(nameof(coreBusinessSqlConfiguration)));
            services.AddTransient <CoreBusinessQueryContext>();

            services.AddMediatR();

            return(services);
        }
Exemplo n.º 2
0
        public static IServiceCollection AddGecipaCoreBusinessEntityFramework(this IServiceCollection services, CoreBusinessSqlConfiguration coreBusinessSqlConfiguration)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }

            services.AddSingleton(coreBusinessSqlConfiguration ?? throw new ArgumentNullException(nameof(coreBusinessSqlConfiguration)));

            services.AddDbContext <CoreBusinessContext>(options => options.UseSqlServer(coreBusinessSqlConfiguration.ConnectionString));

            services.AddScoped <IEstabelecimentoReadOnlyRepository, EstabelecimentoRepository>();
            services.AddScoped <IEstabelecimentoWriteOnlyRepository, EstabelecimentoRepository>();
            services.AddScoped <ICipaReadOnlyRepository, CipaRepository>();
            services.AddScoped <ICipaWriteOnlyRepository, CipaRepository>();
            services.AddScoped <IPlanoDeAcaoReadOnlyRepository, PlanoDeAcaoRepository>();
            services.AddScoped <IPlanoDeAcaoWriteOnlyRepository, PlanoDeAcaoRepository>();
            services.AddScoped <IReuniaoReadOnlyRepository, ReuniaoRepository>();
            services.AddScoped <IReuniaoWriteOnlyRepository, ReuniaoRepository>();

            return(services);
        }