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); }
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); }