public static IServiceCollection AddPlanosDeAcaoEntityFramework(this IServiceCollection services, PlanosDeAcaoSqlConfiguration coreBusinessSqlConfiguration) { if (services == null) { throw new ArgumentNullException(nameof(services)); } services.AddSingleton(coreBusinessSqlConfiguration ?? throw new ArgumentNullException(nameof(coreBusinessSqlConfiguration))); services.AddDbContext <PlanosDeAcaoContext>(options => options.UseSqlServer(coreBusinessSqlConfiguration.ConnectionString)); services.AddScoped <IPlanoDeAcaoReadOnlyRepository, PlanoDeAcaoRepository>(); services.AddScoped <IPlanoDeAcaoWriteOnlyRepository, PlanoDeAcaoRepository>(); return(services); }
public static IServiceCollection AddPlanosDeAcaoQueries(this IServiceCollection services, PlanosDeAcaoSqlConfiguration coreBusinessSqlConfiguration) { if (services == null) { throw new ArgumentNullException(nameof(services)); } services.AddSingleton(coreBusinessSqlConfiguration ?? throw new ArgumentNullException(nameof(coreBusinessSqlConfiguration))); services.AddTransient <PlanosDeAcaoQueryContext>(); services.AddMediatR(typeof(PlanosDeAcaoQueryContext).Assembly); return(services); }