コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }