Skip to content

Commit a00d540

Browse files
committed
Merge branch 'dev_3_0'
2 parents f7dedcf + 7457b0b commit a00d540

File tree

14 files changed

+80
-60
lines changed

14 files changed

+80
-60
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Add the NuGet package to the project.json file
1818

1919
```
2020
"dependencies": {
21-
"Localization.SqlLocalizer": "2.0.5",
21+
"Localization.SqlLocalizer": "2.0.6",
2222
```
2323

2424
Add the DbContext and use the AddSqlLocalization extension method to add the SQL Localization package.

appveyor.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
image: Visual Studio 2017
1+
image: Visual Studio 2019 Preview
22
init:
33
- git config --global core.autocrlf true
4+
environment:
5+
nodejs_version: "12"
46
install:
57
- ECHO %APPVEYOR_BUILD_WORKER_IMAGE%
8+
- ps: Install-Product node $env:nodejs_version
9+
- cmd: choco install dotnetcore-sdk --pre
610
- dotnet --version
711
- dotnet restore
12+
- choco install googlechrome
813
build_script:
914
- dotnet build
1015
before_build:

src/AspNetCoreLocalization/AspNetCoreLocalization.csproj

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

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.2</TargetFramework>
4+
<TargetFramework>netcoreapp3.0</TargetFramework>
55
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Microsoft.AspNetCore.App" />
10-
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.4" />
11-
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.4" PrivateAssets="All" />
12-
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0-beta" />
9+
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0" />
10+
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.0.0" />
11+
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.0.0" PrivateAssets="All" />
12+
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0-rc3" />
1313
</ItemGroup>
1414

1515
<ItemGroup>
Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
using Microsoft.AspNetCore;
1+
using Microsoft.AspNetCore;
22
using Microsoft.AspNetCore.Hosting;
3+
using Microsoft.Extensions.Hosting;
34

45
namespace AspNetCoreLocalization
56
{
67
public class Program
78
{
89
public static void Main(string[] args)
910
{
10-
BuildWebHost(args).Run();
11+
CreateHostBuilder(args).Build().Run();
1112
}
1213

13-
public static IWebHost BuildWebHost(string[] args) =>
14-
WebHost.CreateDefaultBuilder(args)
15-
.UseStartup<Startup>()
16-
.Build();
14+
public static IHostBuilder CreateHostBuilder(string[] args) =>
15+
Host.CreateDefaultBuilder(args)
16+
.ConfigureWebHostDefaults(webBuilder =>
17+
{
18+
webBuilder.UseStartup<Startup>();
19+
});
1720
}
18-
}
21+
}

src/AspNetCoreLocalization/Startup.cs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,24 @@
1414
using Microsoft.AspNetCore.Mvc;
1515
using Swashbuckle.AspNetCore.Swagger;
1616
using System.Reflection;
17+
using Microsoft.Extensions.Hosting;
1718

1819
namespace AspNetCoreLocalization
1920
{
2021
public class Startup
2122
{
2223
private bool _createNewRecordWhenLocalisedStringDoesNotExist = false;
23-
public Startup(IHostingEnvironment env)
24+
public Startup(IConfiguration configuration, IWebHostEnvironment env)
2425
{
25-
var builder = new ConfigurationBuilder()
26-
.SetBasePath(env.ContentRootPath)
27-
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
28-
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
29-
30-
builder.AddEnvironmentVariables();
31-
Configuration = builder.Build();
26+
Configuration = configuration;
3227

3328
if (env.IsDevelopment())
3429
{
3530
_createNewRecordWhenLocalisedStringDoesNotExist = true;
3631
}
3732
}
3833

39-
public IConfigurationRoot Configuration { get; set; }
34+
public IConfiguration Configuration { get; }
4035

4136
public void ConfigureServices(IServiceCollection services)
4237
{
@@ -85,7 +80,9 @@ public void ConfigureServices(IServiceCollection services)
8580
options.SupportedUICultures = supportedCultures;
8681
});
8782

88-
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2)
83+
services.AddControllersWithViews()
84+
.AddNewtonsoftJson()
85+
.SetCompatibilityVersion(CompatibilityVersion.Version_3_0)
8986
.AddViewLocalization()
9087
.AddDataAnnotationsLocalization(options =>
9188
{
@@ -106,21 +103,23 @@ public void ConfigureServices(IServiceCollection services)
106103
});
107104
}
108105

109-
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
106+
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
110107
{
111108
var locOptions = app.ApplicationServices.GetService<IOptions<RequestLocalizationOptions>>();
112109
app.UseRequestLocalization(locOptions.Value);
113110

111+
app.UseDefaultFiles();
114112
app.UseStaticFiles();
115113

116-
app.UseMvc(routes =>
114+
app.UseRouting();
115+
116+
app.UseEndpoints(endpoints =>
117117
{
118-
routes.MapRoute(
118+
endpoints.MapControllerRoute(
119119
name: "default",
120-
template: "{controller=Home}/{action=Index}/{id?}");
120+
pattern: "{controller=Home}/{action=Index}/{id?}");
121121
});
122122

123-
// Enable middleware to serve generated Swagger as a JSON endpoint.
124123
app.UseSwagger();
125124
app.UseSwaggerUI(c =>
126125
{

src/AspNetCoreLocalization/package-lock.json

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/AspNetCoreLocalization/web.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<environmentVariables>
99
<environmentVariable name="ASPNETCORE_HTTPS_PORT" value="44392" />
1010
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
11+
<environmentVariable name="COMPLUS_ForceENC" value="1" />
1112
</environmentVariables>
1213
</aspNetCore>
1314
</system.webServer>

src/ImportExportLocalization/ImportExportLocalization.csproj

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

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.2</TargetFramework>
4+
<TargetFramework>netcoreapp3.0</TargetFramework>
55
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
66
</PropertyGroup>
77

@@ -16,12 +16,13 @@
1616
</ItemGroup>
1717

1818
<ItemGroup>
19-
<PackageReference Include="BuildBundlerMinifier" Version="2.9.406" />
19+
<PackageReference Include="BuildBundlerMinifier" Version="3.0.415" />
2020
<PackageReference Include="Microsoft.AspNetCore.App" />
21-
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.4" PrivateAssets="all">
21+
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0" />
22+
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.0.0" PrivateAssets="all">
2223
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
2324
</PackageReference>
24-
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.4" />
25+
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.0.0" />
2526
<PackageReference Include="WebApiContrib.Core.Formatter.Csv" Version="3.0.0" />
2627
</ItemGroup>
2728

0 Bytes
Binary file not shown.
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
using Microsoft.AspNetCore;
22
using Microsoft.AspNetCore.Hosting;
3+
using Microsoft.Extensions.Hosting;
34

45
namespace ImportExportLocalization
56
{
67
public class Program
78
{
89
public static void Main(string[] args)
910
{
10-
CreateWebHostBuilder(args).Build().Run();
11+
CreateHostBuilder(args).Build().Run();
1112
}
1213

13-
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
14-
WebHost.CreateDefaultBuilder(args)
15-
.UseStartup<Startup>();
14+
public static IHostBuilder CreateHostBuilder(string[] args) =>
15+
Host.CreateDefaultBuilder(args)
16+
.ConfigureWebHostDefaults(webBuilder =>
17+
{
18+
webBuilder.UseStartup<Startup>();
19+
});
1620
}
1721
}

0 commit comments

Comments
 (0)