@@ -32,31 +32,28 @@ public virtual IServiceProvider ConfigureServices(IServiceCollection services)
32
32
{
33
33
// Add framework services.
34
34
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
+ ) ;
42
44
services . AddScoped < IResourceService < TodoItem > , TodoItemService > ( ) ;
43
-
44
45
var optionsBuilder = new DbContextOptionsBuilder < AppDbContext > ( ) ;
45
46
optionsBuilder . UseNpgsql ( Configuration . GetValue < string > ( "Data:DefaultConnection" ) ) ;
46
47
services . AddSingleton < IConfiguration > ( Configuration ) ;
47
- services . AddSingleton < DbContextOptions < AppDbContext > > ( optionsBuilder . Options ) ;
48
+ services . AddSingleton ( optionsBuilder . Options ) ;
48
49
services . AddScoped < AppDbContext > ( ) ;
49
-
50
50
return services . BuildServiceProvider ( ) ;
51
51
}
52
52
53
53
// 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 )
55
55
{
56
- loggerFactory . AddConsole ( Configuration . GetSection ( "Logging" ) ) ;
57
-
58
56
context . Database . EnsureCreated ( ) ;
59
-
60
57
app . UseJsonApi ( ) ;
61
58
}
62
59
}
0 commit comments