Exemple #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc(options => {
                options.Filters.Add(new CustomExceptionFilter());
            })
            .AddFluentValidation(fv => fv.RegisterValidatorsFromAssemblyContaining <BlogDto>())
            .SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            SwaggerConfig.ConfigureServices(services);

            SimpleInjectorConfig.ConfigureServices(services);

            services.AddLogging();
        }
Exemple #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc(options => {
                options.Filters.Add(new CustomExceptionFilter());
            })
            .AddFluentValidation(fv => fv.RegisterValidatorsFromAssemblyContaining <BlogDto>())
            .SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            SwaggerConfig.ConfigureServices(services);

            SimpleInjectorConfig.ConfigureServices(services);

            services.AddLogging();

            services.AddDbContext <AppDbContext>(options =>
                                                 //options.UseSqlServer(Configuration.GetConnectionString("AppDbContext"), b => b.MigrationsAssembly("CoreWebApi.Api"))
                                                 options.UseInMemoryDatabase("CoreWebApi")
                                                 );
        }