예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="services"></param>
        public void ConfigureServices(IServiceCollection services)
        {
            DbContextConfiguration.AddService(services, Configuration);
            CorsConfiguration.AddService(services);
            RouteConfiguration.AddService(services);
            RouteAnalyzerExtension.AddService(services);
            services.AddMemoryCache();
            services.AddHttpContextAccessor();
            services.AddSingleton <IActionContextAccessor, ActionContextAccessor>();

            try
            {
                // TODO: when use code gen, a exception will occurred.
#pragma warning disable 618
                AuthenticationConfiguration.AddService(services, Configuration);
                services.AddAutoMapper();
#pragma warning disable 618
            }
            catch
            {
            }

            WebEncoderConfiguration.AddService(services);
            ValidateConfiguration.AddService(services);
            JsonExtension.AddService(services);
            SetCompatibilityVersionExtension.AddService(services);
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="services"></param>
        public void ConfigureServices(IServiceCollection services)
        {
            SwaggerConfiguration.AddService(services);
            DbContextExtension.AddService(services, Configuration);
            CorsExtension.AddService(services);
            RouteExtension.AddService(services);
            RouteAnalyzerExtension.AddService(services);
            services.AddMemoryCache();
            services.AddHttpContextAccessor();
            services.AddSingleton <IActionContextAccessor, ActionContextAccessor>();

            try
            {
#pragma warning disable 618
                AuthenticationConfiguration.AddService(services, Configuration);
                services.AddAutoMapper();
#pragma warning disable 618
            }
            catch
            {
            }

            WebEncoderConfiguration.AddService(services);
            ValidateConfiguration.AddService(services);
            JsonExtension.AddService(services);
            SetCompatibilityVersionExtension.AddService(services);
        }