Skip to content

Commit 0ff419b

Browse files
authored
Merge pull request #199 from json-api-dotnet/feat/#161-aspnetcore2.0
Feat/#161 aspnetcore2.0
2 parents 0664c3d + 947a079 commit 0ff419b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+374
-420
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services:
66
before_script:
77
- psql -c 'create database JsonApiDotNetCoreExample;' -U postgres
88
mono: none
9-
dotnet: 1.0.4 # https://www.microsoft.com/net/download/linux
9+
dotnet: 2.0.3 # https://www.microsoft.com/net/download/linux
1010
branches:
1111
only:
1212
- master

.vscode/tasks.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"isShellCommand": true,
77
"args": [],
88
"options": {
9-
"cwd": "${workspaceRoot}/src/Examples/JsonApiDotNetCoreExample"
9+
"cwd": "${workspaceRoot}/src/JsonApiDotNetCore"
1010
},
1111
"tasks": [
1212
{

Directory.Build.props

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<Project>
2+
3+
<PropertyGroup>
4+
<NetStandardVersion>netstandard2.0</NetStandardVersion>
5+
<AspNetCoreVersion>2.0.1</AspNetCoreVersion>
6+
<EFCoreVersion>2.0.1</EFCoreVersion>
7+
<MicrosoftLoggingVersion>2.0.0</MicrosoftLoggingVersion>
8+
<MicrosoftConfigurationVersion>2.0.0</MicrosoftConfigurationVersion>
9+
<TuplesVersion>4.4.0</TuplesVersion>
10+
</PropertyGroup>
11+
12+
<!-- Test Project Dependencies -->
13+
<PropertyGroup>
14+
<NetCoreAppVersion>netcoreapp2.0</NetCoreAppVersion>
15+
<MicrosoftOptionsVersion>2.0.0</MicrosoftOptionsVersion>
16+
<NpgsqlPostgreSQLVersion>2.0.0</NpgsqlPostgreSQLVersion>
17+
<NpgsqlVersion>3.2.6</NpgsqlVersion>
18+
<EFCoreToolsVersion>2.0.1</EFCoreToolsVersion>
19+
<TestSdkVersion>15.3.0-preview-20170427-09</TestSdkVersion>
20+
<TestHostVersion>1.1.2</TestHostVersion>
21+
<XUnitVersion>2.3.0-beta3-build3705</XUnitVersion>
22+
<BogusVersion>15.0.3</BogusVersion>
23+
<MoqVersion>4.7.99</MoqVersion>
24+
</PropertyGroup>
25+
26+
</Project>

JsonApiDotnetCore.sln

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Microsoft Visual Studio Solution File, Format Version 12.00
22
# Visual Studio 15
3-
VisualStudioVersion = 15.0.26228.9
3+
VisualStudioVersion = 15.0.26730.10
44
MinimumVisualStudioVersion = 10.0.40219.1
55
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JsonApiDotNetCore", "src\JsonApiDotNetCore\JsonApiDotNetCore.csproj", "{C0EC9E70-EB2E-436F-9D94-FA16FA774123}"
66
EndProject
@@ -18,15 +18,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1818
README.md = README.md
1919
EndProjectSection
2020
EndProject
21-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NoEntityFrameworkExample", "src\Examples\NoEntityFrameworkExample\NoEntityFrameworkExample.csproj", "{570165EC-62B5-4684-A139-8D2A30DD4475}"
21+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NoEntityFrameworkExample", "src\Examples\NoEntityFrameworkExample\NoEntityFrameworkExample.csproj", "{570165EC-62B5-4684-A139-8D2A30DD4475}"
2222
EndProject
23-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NoEntityFrameworkTests", "test\NoEntityFrameworkTests\NoEntityFrameworkTests.csproj", "{73DA578D-A63F-4956-83ED-6D7102E09140}"
23+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NoEntityFrameworkTests", "test\NoEntityFrameworkTests\NoEntityFrameworkTests.csproj", "{73DA578D-A63F-4956-83ED-6D7102E09140}"
2424
EndProject
25-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "test\UnitTests\UnitTests.csproj", "{6D4BD85A-A262-44C6-8572-FE3A30410BF3}"
25+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTests", "test\UnitTests\UnitTests.csproj", "{6D4BD85A-A262-44C6-8572-FE3A30410BF3}"
2626
EndProject
2727
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{026FBC6C-AF76-4568-9B87-EC73457899FD}"
2828
EndProject
29-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReportsExample", "src\Examples\ReportsExample\ReportsExample.csproj", "{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}"
29+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReportsExample", "src\Examples\ReportsExample\ReportsExample.csproj", "{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}"
3030
EndProject
3131
Global
3232
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -88,28 +88,28 @@ Global
8888
{73DA578D-A63F-4956-83ED-6D7102E09140}.Release|x86.Build.0 = Release|Any CPU
8989
{6D4BD85A-A262-44C6-8572-FE3A30410BF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
9090
{6D4BD85A-A262-44C6-8572-FE3A30410BF3}.Debug|Any CPU.Build.0 = Debug|Any CPU
91-
{6D4BD85A-A262-44C6-8572-FE3A30410BF3}.Debug|x64.ActiveCfg = Debug|x64
92-
{6D4BD85A-A262-44C6-8572-FE3A30410BF3}.Debug|x64.Build.0 = Debug|x64
93-
{6D4BD85A-A262-44C6-8572-FE3A30410BF3}.Debug|x86.ActiveCfg = Debug|x86
94-
{6D4BD85A-A262-44C6-8572-FE3A30410BF3}.Debug|x86.Build.0 = Debug|x86
91+
{6D4BD85A-A262-44C6-8572-FE3A30410BF3}.Debug|x64.ActiveCfg = Debug|Any CPU
92+
{6D4BD85A-A262-44C6-8572-FE3A30410BF3}.Debug|x64.Build.0 = Debug|Any CPU
93+
{6D4BD85A-A262-44C6-8572-FE3A30410BF3}.Debug|x86.ActiveCfg = Debug|Any CPU
94+
{6D4BD85A-A262-44C6-8572-FE3A30410BF3}.Debug|x86.Build.0 = Debug|Any CPU
9595
{6D4BD85A-A262-44C6-8572-FE3A30410BF3}.Release|Any CPU.ActiveCfg = Release|Any CPU
9696
{6D4BD85A-A262-44C6-8572-FE3A30410BF3}.Release|Any CPU.Build.0 = Release|Any CPU
97-
{6D4BD85A-A262-44C6-8572-FE3A30410BF3}.Release|x64.ActiveCfg = Release|x64
98-
{6D4BD85A-A262-44C6-8572-FE3A30410BF3}.Release|x64.Build.0 = Release|x64
99-
{6D4BD85A-A262-44C6-8572-FE3A30410BF3}.Release|x86.ActiveCfg = Release|x86
100-
{6D4BD85A-A262-44C6-8572-FE3A30410BF3}.Release|x86.Build.0 = Release|x86
97+
{6D4BD85A-A262-44C6-8572-FE3A30410BF3}.Release|x64.ActiveCfg = Release|Any CPU
98+
{6D4BD85A-A262-44C6-8572-FE3A30410BF3}.Release|x64.Build.0 = Release|Any CPU
99+
{6D4BD85A-A262-44C6-8572-FE3A30410BF3}.Release|x86.ActiveCfg = Release|Any CPU
100+
{6D4BD85A-A262-44C6-8572-FE3A30410BF3}.Release|x86.Build.0 = Release|Any CPU
101101
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
102102
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}.Debug|Any CPU.Build.0 = Debug|Any CPU
103-
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}.Debug|x64.ActiveCfg = Debug|x64
104-
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}.Debug|x64.Build.0 = Debug|x64
105-
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}.Debug|x86.ActiveCfg = Debug|x86
106-
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}.Debug|x86.Build.0 = Debug|x86
103+
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}.Debug|x64.ActiveCfg = Debug|Any CPU
104+
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}.Debug|x64.Build.0 = Debug|Any CPU
105+
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}.Debug|x86.ActiveCfg = Debug|Any CPU
106+
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}.Debug|x86.Build.0 = Debug|Any CPU
107107
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}.Release|Any CPU.ActiveCfg = Release|Any CPU
108108
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}.Release|Any CPU.Build.0 = Release|Any CPU
109-
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}.Release|x64.ActiveCfg = Release|x64
110-
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}.Release|x64.Build.0 = Release|x64
111-
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}.Release|x86.ActiveCfg = Release|x86
112-
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}.Release|x86.Build.0 = Release|x86
109+
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}.Release|x64.ActiveCfg = Release|Any CPU
110+
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}.Release|x64.Build.0 = Release|Any CPU
111+
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}.Release|x86.ActiveCfg = Release|Any CPU
112+
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D}.Release|x86.Build.0 = Release|Any CPU
113113
EndGlobalSection
114114
GlobalSection(SolutionProperties) = preSolution
115115
HideSolutionNode = FALSE
@@ -124,4 +124,7 @@ Global
124124
{026FBC6C-AF76-4568-9B87-EC73457899FD} = {7A2B7ADD-ECB5-4D00-AA6A-D45BD11C97CF}
125125
{FBFB0B0B-EA86-4B41-AB2A-E0249F70C86D} = {026FBC6C-AF76-4568-9B87-EC73457899FD}
126126
EndGlobalSection
127+
GlobalSection(ExtensibilityGlobals) = postSolution
128+
SolutionGuid = {A2421882-8F0A-4905-928F-B550B192F9A4}
129+
EndGlobalSection
127130
EndGlobal
Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,34 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp1.0</TargetFramework>
4+
<TargetFramework>$(NetCoreAppVersion)</TargetFramework>
55
<PreserveCompilationContext>true</PreserveCompilationContext>
66
<AssemblyName>JsonApiDotNetCoreExample</AssemblyName>
77
<OutputType>Exe</OutputType>
88
<PackageId>JsonApiDotNetCoreExample</PackageId>
9-
<RuntimeFrameworkVersion>1.1.1</RuntimeFrameworkVersion>
10-
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.6;portable-net45+win8</PackageTargetFallback>
119
</PropertyGroup>
1210

1311
<ItemGroup>
1412
<ProjectReference Include="../../JsonApiDotNetCore/JsonApiDotNetCore.csproj" />
1513
</ItemGroup>
1614

1715
<ItemGroup>
18-
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.2" />
19-
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.2" />
20-
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="1.1.2" />
21-
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.2" />
22-
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="1.1.2" />
23-
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.2" />
24-
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.2" />
25-
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" />
26-
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.2" />
27-
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.1" />
28-
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.2" />
29-
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="1.1.0" />
30-
<PackageReference Include="DotNetCoreDocs" Version="0.4.0" />
16+
<PackageReference Include="Microsoft.AspNetCore" Version="$(AspNetCoreVersion)" />
17+
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="$(MicrosoftConfigurationVersion)" />
18+
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="$(MicrosoftConfigurationVersion)" />
19+
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="$(MicrosoftConfigurationVersion)" />
20+
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="$(MicrosoftConfigurationVersion)" />
21+
<PackageReference Include="Microsoft.Extensions.Logging" Version="$(MicrosoftLoggingVersion)" />
22+
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftLoggingVersion)" />
23+
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="$(MicrosoftLoggingVersion)" />
24+
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="$(MicrosoftOptionsVersion)" />
25+
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="$(EFCoreToolsVersion)" />
26+
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="$(EFCoreToolsVersion)" />
27+
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="$(NpgsqlPostgreSQLVersion)" />
3128
</ItemGroup>
3229

3330
<ItemGroup>
34-
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
31+
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="$(EFCoreToolsVersion)" />
3532
</ItemGroup>
3633

3734
</Project>
Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,18 @@
1-
using System.IO;
1+
using Microsoft.AspNetCore;
22
using Microsoft.AspNetCore.Hosting;
3-
using Microsoft.Extensions.Configuration;
43

54
namespace JsonApiDotNetCoreExample
65
{
76
public class Program
87
{
98
public static void Main(string[] args)
109
{
11-
var config = new ConfigurationBuilder()
12-
.AddCommandLine(args)
13-
.AddEnvironmentVariables(prefix: "ASPNETCORE_")
14-
.Build();
10+
BuildWebHost(args).Run();
11+
}
1512

16-
var host = new WebHostBuilder()
17-
.UseConfiguration(config)
18-
.UseKestrel()
19-
.UseContentRoot(Directory.GetCurrentDirectory())
13+
public static IWebHost BuildWebHost(string[] args) =>
14+
WebHost.CreateDefaultBuilder(args)
2015
.UseStartup<Startup>()
2116
.Build();
22-
23-
host.Run();
24-
}
2517
}
2618
}

src/Examples/JsonApiDotNetCoreExample/Startup.cs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
using JsonApiDotNetCoreExample.Data;
77
using Microsoft.EntityFrameworkCore;
88
using JsonApiDotNetCore.Extensions;
9-
using DotNetCoreDocs.Configuration;
10-
using DotNetCoreDocs.Middleware;
119
using System;
1210

1311
namespace JsonApiDotNetCoreExample
@@ -20,7 +18,7 @@ public Startup(IHostingEnvironment env)
2018
{
2119
var builder = new ConfigurationBuilder()
2220
.SetBasePath(env.ContentRootPath)
23-
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
21+
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
2422
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
2523
.AddEnvironmentVariables();
2624

@@ -30,8 +28,7 @@ public Startup(IHostingEnvironment env)
3028
public virtual IServiceProvider ConfigureServices(IServiceCollection services)
3129
{
3230
var loggerFactory = new LoggerFactory();
33-
loggerFactory
34-
.AddConsole(LogLevel.Trace);
31+
loggerFactory.AddConsole(LogLevel.Trace);
3532
services.AddSingleton<ILoggerFactory>(loggerFactory);
3633

3734
services.AddDbContext<AppDbContext>(options =>
@@ -46,8 +43,6 @@ public virtual IServiceProvider ConfigureServices(IServiceCollection services)
4643
opt.IncludeTotalRecordCount = true;
4744
});
4845

49-
services.AddDocumentationConfiguration(Config);
50-
5146
var provider = services.BuildServiceProvider();
5247
var appContext = provider.GetRequiredService<AppDbContext>();
5348
if(appContext == null)
@@ -67,14 +62,9 @@ public virtual void Configure(
6762
loggerFactory.AddConsole(Config.GetSection("Logging"));
6863
loggerFactory.AddDebug();
6964

70-
app.UseDocs();
71-
7265
app.UseJsonApi();
7366
}
7467

75-
public string GetDbConnectionString()
76-
{
77-
return Config["Data:DefaultConnection"];
78-
}
68+
public string GetDbConnectionString() => Config["Data:DefaultConnection"];
7969
}
8070
}
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"Data": {
3-
"DefaultConnection": "Host=localhost;Port=5432;Database=JsonApiDotNetCoreExample;User ID=postgres;Password=password"
3+
"DefaultConnection":
4+
"Host=localhost;Port=5432;Database=JsonApiDotNetCoreExample;User ID=postgres;Password=password"
45
},
56
"Logging": {
67
"IncludeScopes": false,
@@ -9,10 +10,5 @@
910
"System": "Trace",
1011
"Microsoft": "Trace"
1112
}
12-
},
13-
"DocsConfiguration": {
14-
"BaseAddress": "http://localhost:5000",
15-
"RequestsDirectory": "../../src/JsonApiDotNetCoreExample/_data",
16-
"DocumentationRoute": "/docs"
1713
}
1814
}

src/Examples/NoEntityFrameworkExample/NoEntityFrameworkExample.csproj

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp1.0</TargetFramework>
5-
<RuntimeFrameworkVersion>1.1.1</RuntimeFrameworkVersion>
6-
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.6;portable-net45+win8</PackageTargetFallback>
4+
<TargetFramework>$(NetCoreAppVersion)</TargetFramework>
75
</PropertyGroup>
86

97
<ItemGroup>
@@ -16,11 +14,11 @@
1614
</ItemGroup>
1715

1816
<ItemGroup>
19-
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.2" />
20-
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" />
21-
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" />
22-
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="1.1.0" />
23-
<PackageReference Include="Npgsql" Version="3.2.2" />
17+
<PackageReference Include="Microsoft.AspNetCore" Version="$(AspNetCoreVersion)" />
18+
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="$(AspNetCoreVersion)" />
19+
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="$(MicrosoftLoggingVersion)" />
20+
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="$(NpgsqlPostgreSQLVersion)" />
21+
<PackageReference Include="Npgsql" Version="$(NpgsqlVersion)" />
2422
<PackageReference Include="Dapper" Version="1.50.2" />
2523
</ItemGroup>
2624

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.IO;
1+
using Microsoft.AspNetCore;
22
using Microsoft.AspNetCore.Hosting;
33

44
namespace NoEntityFrameworkExample
@@ -7,14 +7,12 @@ public class Program
77
{
88
public static void Main(string[] args)
99
{
10-
var host = new WebHostBuilder()
11-
.UseKestrel()
12-
.UseContentRoot(Directory.GetCurrentDirectory())
13-
.UseIISIntegration()
10+
BuildWebHost(args).Run();
11+
}
12+
13+
public static IWebHost BuildWebHost(string[] args) =>
14+
WebHost.CreateDefaultBuilder(args)
1415
.UseStartup<Startup>()
1516
.Build();
16-
17-
host.Run();
18-
}
1917
}
2018
}

src/Examples/NoEntityFrameworkExample/Startup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public Startup(IHostingEnvironment env)
1818
{
1919
var builder = new ConfigurationBuilder()
2020
.SetBasePath(env.ContentRootPath)
21-
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
21+
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: false)
2222
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
2323
.AddEnvironmentVariables();
2424
Configuration = builder.Build();
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.IO;
1+
using Microsoft.AspNetCore;
22
using Microsoft.AspNetCore.Hosting;
33

44
namespace ReportsExample
@@ -7,14 +7,12 @@ public class Program
77
{
88
public static void Main(string[] args)
99
{
10-
var host = new WebHostBuilder()
11-
.UseKestrel()
12-
.UseContentRoot(Directory.GetCurrentDirectory())
13-
.UseIISIntegration()
10+
BuildWebHost(args).Run();
11+
}
12+
13+
public static IWebHost BuildWebHost(string[] args) =>
14+
WebHost.CreateDefaultBuilder(args)
1415
.UseStartup<Startup>()
1516
.Build();
16-
17-
host.Run();
18-
}
1917
}
2018
}

0 commit comments

Comments
 (0)