Skip to content

Commit bd73c69

Browse files
committed
update performance tests to netcoreapp2.1
Signed-off-by: Caleb Lloyd <[email protected]>
1 parent 2b29279 commit bd73c69

File tree

3 files changed

+31
-23
lines changed

3 files changed

+31
-23
lines changed
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
using System.IO;
1+
using System;
2+
using System.IO;
3+
using System.Reflection;
24
using Microsoft.Extensions.Configuration;
35

46
namespace MySqlConnector.Performance
57
{
68
public static class AppConfig
79
{
8-
public static IConfigurationRoot Config = new ConfigurationBuilder()
9-
.SetBasePath(Directory.GetCurrentDirectory())
10+
public static IConfigurationRoot Config => LazyConfig.Value;
11+
12+
private static readonly Lazy<IConfigurationRoot> LazyConfig = new Lazy<IConfigurationRoot>(() => new ConfigurationBuilder()
13+
.SetBasePath(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location))
1014
.AddJsonFile("appsettings.json")
1115
.AddJsonFile("config.json")
12-
.Build();
16+
.Build());
1317
}
1418
}
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<Project Sdk="Microsoft.NET.Sdk.Web">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netcoreapp2.0</TargetFrameworks>
4+
<TargetFramework>netcoreapp2.1</TargetFramework>
55
<PreserveCompilationContext>true</PreserveCompilationContext>
66
<AssemblyName>MySqlConnector.Performance</AssemblyName>
77
<OutputType>Exe</OutputType>
@@ -12,27 +12,27 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0-*" />
16-
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.0.0-*" />
17-
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.0.0-*" />
18-
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.0.0-*" />
19-
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.0.0-*" />
20-
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="2.0.0-*" />
21-
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.0.0-*" />
22-
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.0.0-*" />
23-
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.0-*" />
24-
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.0.0-*" />
15+
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.0" />
2516
</ItemGroup>
2617

2718
<ItemGroup Condition=" '$(Configuration)' != 'Baseline' ">
2819
<ProjectReference Include="..\..\src\MySqlConnector\MySqlConnector.csproj" />
2920
</ItemGroup>
3021

3122
<ItemGroup Condition=" '$(Configuration)' == 'Baseline' ">
32-
<PackageReference Include="MySql.Data" Version="7.0.7-m61" />
23+
<PackageReference Include="MySql.Data" Version="8.0.11" />
3324
</ItemGroup>
3425
<PropertyGroup Condition=" '$(Configuration)' == 'Baseline' ">
3526
<DefineConstants>BASELINE</DefineConstants>
3627
</PropertyGroup>
3728

29+
<ItemGroup>
30+
<None Update="appsettings.json">
31+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
32+
</None>
33+
<None Update="config.json">
34+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
35+
</None>
36+
</ItemGroup>
37+
3838
</Project>
Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using Microsoft.AspNetCore;
23
using Microsoft.AspNetCore.Hosting;
34
using MySqlConnector.Performance.Commands;
45

@@ -11,17 +12,20 @@ public static void Main(string[] args)
1112
AppDb.Initialize();
1213
if (args.Length == 0)
1314
{
14-
var host = new WebHostBuilder()
15-
.UseUrls("http://*:5000")
16-
.UseKestrel()
17-
.UseStartup<Startup>()
18-
.Build();
19-
host.Run();
15+
BuildWebHost(args).Run();
2016
}
2117
else
2218
{
2319
Environment.Exit(CommandRunner.Run(args));
2420
}
2521
}
22+
23+
public static IWebHost BuildWebHost(string[] args)
24+
{
25+
return WebHost.CreateDefaultBuilder(args)
26+
.UseUrls("http://*:5000")
27+
.UseStartup<Startup>()
28+
.Build();
29+
}
2630
}
2731
}

0 commit comments

Comments
 (0)