Пример #1
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddSwagger();

            services.AddProjectIdentity(Configuration);

            services.AddCqrs();

            services.AddDbConnectors();

            services.AddAutoMapper(typeof(Startup));

            services.AddMediatR(typeof(Startup));

            services.AddValidatorsFromAssembly(typeof(Startup).Assembly);

            services.AddRepositories();

            services.AddEventSourcing(Configuration);

            services.AddHateoas();

            services.AddControllers();

            ConnectionManagerBase
            .SetConnectionString(Configuration.GetConnectionString("DefaultConnection"));
        }
Пример #2
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddSettings(Configuration);

            services.AddDbContext(Configuration.GetConnectionString("DefaultConnection"));

            services.AddDbConnectors();

            services.AddRepositories();

            services.AddMapper();

            services.AddSwagger();

            services.AddJwtIdentity(Configuration.GetSection(nameof(JwtConfiguration)));

            services.AddLogging(logBuilder => logBuilder.AddSerilog(dispose: true));

            services.AddMarten(Configuration);

            services.AddCqrs();

            services.AddMediatR();

            services.AddExcelWorkbook();

            services.AddGenerators();

            services.AddDatabaseLogger();

            services.AddHttpContextAccessor();

            services.AddFileLoaderServices();

            services.AddNotificationManager();

            services.AddMvc(options =>
            {
                options.ModelBinderProviders.Insert(0, new OptionModelBinderProvider());

                options.Filters.Add <ModelStateFilter>();

                options.Filters.Add(
                    new AsyncExceptionFilter(
                        services.BuildServiceProvider().GetRequiredService <IAsyncLogger>()));

                options.RespectBrowserAcceptHeader = true;
            })
            .AddFluentValidation(fv => fv.RegisterValidatorsFromAssemblyContaining <RegisterValidator>())
            .SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            ConnectionManagerBase.SetConnectionString(Configuration.GetConnectionString("DefaultConnection"));
        }
        /// <summary>
        /// This method gets called by the runtime. Use this method to add services to the container.
        /// </summary>
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddSettings(Configuration);

            services.AddMemoryCache();

            services.AddResponseCaching();

            services.AddDbContext(Configuration.GetConnectionString("DefaultConnection"));

            services.AddDbConnectors();

            services.AddTransient <DatabaseSeeder>();

            services.AddAutoMapper(typeof(Startup));

            services.AddMediatR(typeof(Startup));

            services.AddSwagger();

            services.AddCqrs();

            services.AddEventSourcing(Configuration);

            services.AddHateoas();

            services.AddRepositories();

            services.AddRabbitMqService(Configuration);

            services
            .AddMvc(options =>
            {
                options.Filters.Add <ExceptionFilter>();
            })
            .AddFluentValidation(fv =>
            {
                fv.RegisterValidatorsFromAssemblyContaining <BeginPersonalityTestValidator>();
            })
            .SetCompatibilityVersion(CompatibilityVersion.Version_2_2);

            ConnectionManagerBase
            .SetConnectionString(Configuration.GetConnectionString("DefaultConnection"));
        }
Пример #4
0
        /// <summary>
        /// add services to the container.
        /// </summary>
        /// <param name="services"></param>
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();

            services.AddMemoryCache();

            services.AddResponseCaching();

            services.AddDbConnectors();

            services.AddAutoMapper(typeof(Startup));

            services.AddMediatR(Assembly.GetExecutingAssembly());

            services.AddSwagger();

            services.AddCqrs();

            services.AddEventSourcing(Configuration);

            services.AddHateoas();

            services.AddRepositories();

            services
            .AddMvc(options =>
            {
                options.Filters.Add <ExceptionFilter>();
            })
            .AddFluentValidation(fv =>
            {
                fv.RegisterValidatorsFromAssemblyContaining <SaveUserAnswersValidator>();
            })
            .SetCompatibilityVersion(CompatibilityVersion.Version_3_0);

            ConnectionManagerBase
            .SetConnectionString(Configuration.GetConnectionString("DefaultConnection"));
        }