@@ -15,7 +15,7 @@ namespace JsonApiDotNetCoreExample
15
15
{
16
16
public class Startup
17
17
{
18
- private readonly IConfiguration _config ;
18
+ public readonly IConfiguration Config ;
19
19
20
20
public Startup ( IHostingEnvironment env )
21
21
{
@@ -25,10 +25,10 @@ public Startup(IHostingEnvironment env)
25
25
. AddJsonFile ( $ "appsettings.{ env . EnvironmentName } .json", optional : true )
26
26
. AddEnvironmentVariables ( ) ;
27
27
28
- _config = builder . Build ( ) ;
28
+ Config = builder . Build ( ) ;
29
29
}
30
30
31
- public IServiceProvider ConfigureServices ( IServiceCollection services )
31
+ public virtual IServiceProvider ConfigureServices ( IServiceCollection services )
32
32
{
33
33
var loggerFactory = new LoggerFactory ( ) ;
34
34
loggerFactory
@@ -37,7 +37,7 @@ public IServiceProvider ConfigureServices(IServiceCollection services)
37
37
38
38
services . AddDbContext < AppDbContext > ( options =>
39
39
{
40
- options . UseNpgsql ( _getDbConnectionString ( ) ) ;
40
+ options . UseNpgsql ( GetDbConnectionString ( ) ) ;
41
41
} , ServiceLifetime . Transient ) ;
42
42
43
43
services . AddJsonApi < AppDbContext > ( opt =>
@@ -46,7 +46,7 @@ public IServiceProvider ConfigureServices(IServiceCollection services)
46
46
opt . DefaultPageSize = 5 ;
47
47
} ) ;
48
48
49
- services . AddDocumentationConfiguration ( _config ) ;
49
+ services . AddDocumentationConfiguration ( Config ) ;
50
50
51
51
var provider = services . BuildServiceProvider ( ) ;
52
52
var appContext = provider . GetRequiredService < AppDbContext > ( ) ;
@@ -55,25 +55,25 @@ public IServiceProvider ConfigureServices(IServiceCollection services)
55
55
return provider ;
56
56
}
57
57
58
- public void Configure (
58
+ public virtual void Configure (
59
59
IApplicationBuilder app ,
60
60
IHostingEnvironment env ,
61
61
ILoggerFactory loggerFactory ,
62
62
AppDbContext context )
63
63
{
64
64
context . Database . Migrate ( ) ;
65
65
66
- loggerFactory . AddConsole ( _config . GetSection ( "Logging" ) ) ;
66
+ loggerFactory . AddConsole ( Config . GetSection ( "Logging" ) ) ;
67
67
loggerFactory . AddDebug ( ) ;
68
68
69
69
app . UseDocs ( ) ;
70
70
71
71
app . UseJsonApi ( ) ;
72
72
}
73
73
74
- private string _getDbConnectionString ( )
74
+ public string GetDbConnectionString ( )
75
75
{
76
- return _config [ "Data:DefaultConnection" ] ;
76
+ return Config [ "Data:DefaultConnection" ] ;
77
77
}
78
78
}
79
79
}
0 commit comments