@@ -32,31 +32,28 @@ public virtual IServiceProvider ConfigureServices(IServiceCollection services)
3232 {
3333 // Add framework services.
3434 var mvcBuilder = services . AddMvcCore ( ) ;
35-
36- services . AddJsonApi (
37- options => options . Namespace = "api/v1" ,
38- resources : resources => resources . AddResource < TodoItem > ( "custom-todo-items" ) ,
39- mvcBuilder : mvcBuilder
40- ) ;
41-
35+ services . AddLogging ( builder =>
36+ {
37+ builder . AddConfiguration ( Configuration . GetSection ( "Logging" ) ) ;
38+ builder . AddConsole ( ) ;
39+ } ) . AddJsonApi (
40+ options => options . Namespace = "api/v1" ,
41+ resources : resources => resources . AddResource < TodoItem > ( "custom-todo-items" ) ,
42+ mvcBuilder : mvcBuilder
43+ ) ;
4244 services . AddScoped < IResourceService < TodoItem > , TodoItemService > ( ) ;
43-
4445 var optionsBuilder = new DbContextOptionsBuilder < AppDbContext > ( ) ;
4546 optionsBuilder . UseNpgsql ( Configuration . GetValue < string > ( "Data:DefaultConnection" ) ) ;
4647 services . AddSingleton < IConfiguration > ( Configuration ) ;
47- services . AddSingleton < DbContextOptions < AppDbContext > > ( optionsBuilder . Options ) ;
48+ services . AddSingleton ( optionsBuilder . Options ) ;
4849 services . AddScoped < AppDbContext > ( ) ;
49-
5050 return services . BuildServiceProvider ( ) ;
5151 }
5252
5353 // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
54- public void Configure ( IApplicationBuilder app , IHostingEnvironment env , ILoggerFactory loggerFactory , AppDbContext context )
54+ public void Configure ( IApplicationBuilder app , AppDbContext context )
5555 {
56- loggerFactory . AddConsole ( Configuration . GetSection ( "Logging" ) ) ;
57-
5856 context . Database . EnsureCreated ( ) ;
59-
6057 app . UseJsonApi ( ) ;
6158 }
6259 }
0 commit comments