示例#1
0
        /// <summary>
        ///     Configures the services to add to the ASP.NET Core Injection of Control (IoC) container. This method gets
        ///     called by the ASP.NET runtime. See
        ///     http://blogs.msdn.com/b/webdev/archive/2014/06/17/dependency-injection-in-asp-net-vnext.aspx
        /// </summary>
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddCorrelationIdFluent();
            services.AddCustomCaching();
            services.AddCustomOptions(configuration);
            services.AddCustomRouting();
            services.AddCustomResponseCompression();
            services.AddCustomStrictTransportSecurity();
            services.AddCustomHealthChecks();
            services.AddHttpContextAccessor();
            services.AddMediatR(Assembly.GetExecutingAssembly());
            services.AddMvcCore()
            .SetCompatibilityVersion(CompatibilityVersion.Version_2_2)
            .AddAuthorization()
            .AddJsonFormatters()
            .AddCustomJsonOptions(this.hostingEnvironment)
            .AddCustomCors()
            .AddCustomMvcOptions(this.hostingEnvironment);

            //services.ConfigureCors();
            services.AddCustomGraphQL(hostingEnvironment);
            services.ConfigureMySqlContext(configuration);
            services.ConfigureUnitOfWork();
            services.ConfigureDomainService();
            services.ConfigureApplicationService();
            services.ConfigureProjectSchemas();
            services.ConfigureMediatr();
            services.BuildServiceProvider();
            services.ConfigureAuthentication(configuration);
            MappingExtensions.ConfigureMapping();
        }