Skip to content

Commit 8432b42

Browse files
authored
Update TargetFramework to .NET 7 (#112)
* Update TargetFramework to .NET 7 * Update projects to reflect modern .NET patterns * Update README * Update package versions from 4.2.0 -> 7.0.0 * rename method * update packages * Update release notes and CI pipelines for .NET 7 * Use .NEt 7.x and update unit test project to .NET 7 * update package release notes
1 parent e545953 commit 8432b42

28 files changed

+177
-203
lines changed

.github/workflows/dotnetcore.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Setup .NET Core
1818
uses: actions/setup-dotnet@v1
1919
with:
20-
dotnet-version: '7.0.x'
20+
dotnet-version: '7.x'
2121
- name: Install dependencies
2222
run: dotnet restore
2323
- name: Build

.github/workflows/publish-result-related.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Setup .NET Core
1515
uses: actions/setup-dotnet@v1
1616
with:
17-
dotnet-version: 6.0.x
17+
dotnet-version: '7.x'
1818
- name: Install dependencies
1919
run: dotnet restore
2020
- name: Build

.github/workflows/publish-result.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- name: Setup .NET Core
1414
uses: actions/setup-dotnet@v1
1515
with:
16-
dotnet-version: 6.0.x
16+
dotnet-version: '7.x'
1717
- name: Install dependencies
1818
run: dotnet restore
1919
- name: Build

Ardalis.Result.sln

+7-6
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ardalis.Result.Sample.Core"
2525
EndProject
2626
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ardalis.Result.FluentValidation", "src\Ardalis.Result.FluentValidation\Ardalis.Result.FluentValidation.csproj", "{43443B4B-2305-4CDF-A7A4-32A80ED1D19B}"
2727
EndProject
28-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ardalis.Result.AspNetCore.UnitTests", "tests\Ardalis.Result.AspNetCore.UnitTests\Ardalis.Result.AspNetCore.UnitTests.csproj", "{0BDA82F9-3602-4705-8DCD-A4724CAAF800}"
29-
EndProject
3028
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ardalis.Result.SampleMinimalApi", "sample\Ardalis.Result.SampleMinimalApi\Ardalis.Result.SampleMinimalApi.csproj", "{60860685-37BB-47D9-B0DC-6FE7F0DB2AE5}"
3129
EndProject
3230
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ardalis.Result.SampleMinimalApi.FunctionalTests", "sample\Ardalis.Result.SampleMinimalApi.FunctionalTests\Ardalis.Result.SampleMinimalApi.FunctionalTests.csproj", "{A9769533-C9B2-4AD4-8B24-70C474D8EBB0}"
3331
EndProject
32+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ardalis.Result.AspNetCore.UnitTests", "tests\Ardalis.Result.AspNetCore.UnitTests\Ardalis.Result.AspNetCore.UnitTests.csproj", "{C522FE42-BBEF-46A7-9E3E-44EA8339AF2E}"
33+
EndProject
3434
Global
3535
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3636
Debug|Any CPU = Debug|Any CPU
@@ -69,10 +69,6 @@ Global
6969
{43443B4B-2305-4CDF-A7A4-32A80ED1D19B}.Debug|Any CPU.Build.0 = Debug|Any CPU
7070
{43443B4B-2305-4CDF-A7A4-32A80ED1D19B}.Release|Any CPU.ActiveCfg = Release|Any CPU
7171
{43443B4B-2305-4CDF-A7A4-32A80ED1D19B}.Release|Any CPU.Build.0 = Release|Any CPU
72-
{0BDA82F9-3602-4705-8DCD-A4724CAAF800}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
73-
{0BDA82F9-3602-4705-8DCD-A4724CAAF800}.Debug|Any CPU.Build.0 = Debug|Any CPU
74-
{0BDA82F9-3602-4705-8DCD-A4724CAAF800}.Release|Any CPU.ActiveCfg = Release|Any CPU
75-
{0BDA82F9-3602-4705-8DCD-A4724CAAF800}.Release|Any CPU.Build.0 = Release|Any CPU
7672
{60860685-37BB-47D9-B0DC-6FE7F0DB2AE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
7773
{60860685-37BB-47D9-B0DC-6FE7F0DB2AE5}.Debug|Any CPU.Build.0 = Debug|Any CPU
7874
{60860685-37BB-47D9-B0DC-6FE7F0DB2AE5}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -81,6 +77,10 @@ Global
8177
{A9769533-C9B2-4AD4-8B24-70C474D8EBB0}.Debug|Any CPU.Build.0 = Debug|Any CPU
8278
{A9769533-C9B2-4AD4-8B24-70C474D8EBB0}.Release|Any CPU.ActiveCfg = Release|Any CPU
8379
{A9769533-C9B2-4AD4-8B24-70C474D8EBB0}.Release|Any CPU.Build.0 = Release|Any CPU
80+
{C522FE42-BBEF-46A7-9E3E-44EA8339AF2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
81+
{C522FE42-BBEF-46A7-9E3E-44EA8339AF2E}.Debug|Any CPU.Build.0 = Debug|Any CPU
82+
{C522FE42-BBEF-46A7-9E3E-44EA8339AF2E}.Release|Any CPU.ActiveCfg = Release|Any CPU
83+
{C522FE42-BBEF-46A7-9E3E-44EA8339AF2E}.Release|Any CPU.Build.0 = Release|Any CPU
8484
EndGlobalSection
8585
GlobalSection(SolutionProperties) = preSolution
8686
HideSolutionNode = FALSE
@@ -96,6 +96,7 @@ Global
9696
{43443B4B-2305-4CDF-A7A4-32A80ED1D19B} = {865A74CD-F478-4AA5-AFA5-6C26FB38B849}
9797
{60860685-37BB-47D9-B0DC-6FE7F0DB2AE5} = {FA061DC6-61B7-401F-87A4-D338B396CCD9}
9898
{A9769533-C9B2-4AD4-8B24-70C474D8EBB0} = {FA061DC6-61B7-401F-87A4-D338B396CCD9}
99+
{C522FE42-BBEF-46A7-9E3E-44EA8339AF2E} = {42693FB1-04E1-4635-B249-E1847609E801}
99100
EndGlobalSection
100101
GlobalSection(ExtensibilityGlobals) = postSolution
101102
SolutionGuid = {7CD0ED8C-3B1C-4F16-8B8D-3D8F1A8F1A5A}

README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public async Task<ActionResult<CustomerDTO>>(int customerId)
6969

7070
Another approach is to return a `Tuple` of the expected result along with other things, like a status code and additional failure mode metadata. While tuples can be great for individual, flexible responses, they're not as good for having a single, standard, reusable approach to a problem.
7171

72-
The result pattern provides a standard, reusable way to return both success as well as multiple kinds of non-success responses from .NET services in a way that can easily be mapped to API response types. Although the [Ardalis.Result](https://www.nuget.org/packages/Ardalis.Result/) package has no dependencies on ASP.NET Core and can be used from any .NET Core application, the [Ardalis.Result.AspNetCore](https://www.nuget.org/packages/Ardalis.Result.AspNetCore/) companion package includes resources to enhance the use of this pattern within ASP.NET Core web API applications.
72+
The Result pattern provides a standard, reusable way to return both success as well as multiple kinds of non-success responses from .NET services in a way that can easily be mapped to API response types. Although the [Ardalis.Result](https://www.nuget.org/packages/Ardalis.Result/) package has no dependencies on ASP.NET Core and can be used from any .NET Core application, the [Ardalis.Result.AspNetCore](https://www.nuget.org/packages/Ardalis.Result.AspNetCore/) companion package includes resources to enhance the use of this pattern within ASP.NET Core web API applications.
7373

7474
## Sample Usage
7575

@@ -164,16 +164,16 @@ public ActionResult<WeatherForecastSummaryDto> CreateSummaryForecast([FromBody]
164164
}
165165
```
166166

167-
## Asp Net API Metadata
167+
## ASP.NET API Metadata
168168

169-
By default, Asp Net Core and Api Explorer know nothing about `[TranslateResultToActionResult]` and what it is doing. To reflect `[TranslateResultToActionResult]` behavior in metadata generated by Api Explorer (which is then used by tools like Swashbuckle, NSwag etc.), you can use `ResultConvention`:
169+
By default, Asp Net Core and API Explorer know nothing about `[TranslateResultToActionResult]` and what it is doing. To reflect `[TranslateResultToActionResult]` behavior in metadata generated by API Explorer (which is then used by tools like Swashbuckle, NSwag etc.), you can use `ResultConvention`:
170170

171171
```csharp
172172
services.AddControllers(mvcOptions => mvcOptions.AddDefaultResultConvention());
173173
```
174174

175175
This will add `[ProducesResponseType]` for every known `ResultStatus` to every endpoint marked with `[TranslateResultToActionResult]`.
176-
To customize ResultConvention behavior, one may use `AddResultConvention` method:
176+
To customize ResultConvention behavior, one may use the `AddResultConvention` method:
177177

178178
```csharp
179179
services.AddControllers(mvcOptions => mvcOptions
@@ -182,9 +182,9 @@ services.AddControllers(mvcOptions => mvcOptions
182182
));
183183
```
184184

185-
This code is functionally equivalent to previous example.
185+
This code is functionally equivalent to the previous example.
186186

187-
From here you can modify ResultStatus-to-HttpStatusCode mapping
187+
From here you can modify the ResultStatus to HttpStatusCode mapping
188188

189189
```csharp
190190
services.AddControllers(mvcOptions => mvcOptions
@@ -211,7 +211,7 @@ services.AddControllers(mvcOptions => mvcOptions
211211
));
212212
```
213213

214-
Alternatively, you can specify which (failure) result statuses are expected from certain endpoint:
214+
Alternatively, you can specify which (failure) result statuses are expected from a certain endpoint:
215215

216216
```csharp
217217
[TranslateResultToActionResult()]
@@ -223,9 +223,9 @@ public Result RemovePerson(int id)
223223
}
224224
```
225225

226-
`!!!` If you list certain result status in `ExpectedFailures`, it must be configured in `ResultConvention` on startup.
226+
`!!!` If you list a certain Result status in `ExpectedFailures`, it must be configured in `ResultConvention` on startup.
227227

228-
Another configurability feature is what part of Result object is returned in case of specific failure:
228+
Another configurable feature is what part of the Result object is returned in case of specific failure:
229229

230230
```csharp
231231
services.AddControllers(mvcOptions => mvcOptions

sample/Ardalis.Result.Sample.Core/Ardalis.Result.Sample.Core.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net7.0</TargetFramework>
55
<AssemblyName>Ardalis.Result.Sample.Core</AssemblyName>
66
<RootNamespace>Ardalis.Result.Sample.Core</RootNamespace>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="6.0.13" />
10+
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="7.0.3" />
1111
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
1212
<PackageReference Include="System.Runtime" Version="4.3.1" />
1313
</ItemGroup>

sample/Ardalis.Result.Sample.UnitTests/Ardalis.Result.Sample.UnitTests.csproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net7.0</TargetFramework>
55

66
<IsPackable>false</IsPackable>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="FluentAssertions" Version="6.9.0" />
11-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
10+
<PackageReference Include="FluentAssertions" Version="6.10.0" />
11+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
1212
<PackageReference Include="xunit" Version="2.4.2" />
1313
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
1414
<PrivateAssets>all</PrivateAssets>

sample/Ardalis.Result.SampleMinimalApi.FunctionalTests/Ardalis.Result.SampleMinimalApi.FunctionalTests.csproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net6.0</TargetFramework>
3+
<TargetFramework>net7.0</TargetFramework>
44

55
<IsPackable>false</IsPackable>
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.13" />
10-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
9+
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.3" />
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
1111
<PackageReference Include="xunit" Version="2.4.2" />
1212
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
1313
<PrivateAssets>all</PrivateAssets>

sample/Ardalis.Result.SampleMinimalApi/Ardalis.Result.SampleMinimalApi.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net7.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
</PropertyGroup>
@@ -12,7 +12,7 @@
1212

1313
<ItemGroup>
1414
<ProjectReference Include="..\..\src\Ardalis.Result.AspNetCore\Ardalis.Result.AspNetCore.csproj">
15-
<SetTargetFramework>TargetFramework=net6.0</SetTargetFramework>
15+
<SetTargetFramework>TargetFramework=net7.0</SetTargetFramework>
1616
</ProjectReference>
1717
<ProjectReference Include="..\Ardalis.Result.Sample.Core\Ardalis.Result.Sample.Core.csproj" />
1818
</ItemGroup>

sample/Ardalis.Result.SampleMinimalApi/Program.cs

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
var builder = WebApplication.CreateBuilder(args);
88

9-
// Add services to the container.
10-
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
119
builder.Services.AddEndpointsApiExplorer();
1210
builder.Services.AddSwaggerGen();
1311
builder.Services.AddScoped<WeatherService>();

sample/Ardalis.Result.SampleWeb.FunctionalTests/Ardalis.Result.SampleWeb.FunctionalTests.csproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net7.0</TargetFramework>
55

66
<IsPackable>false</IsPackable>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.13" />
11-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
10+
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.3" />
11+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
1212
<PackageReference Include="xunit" Version="2.4.2" />
1313
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
1414
<PrivateAssets>all</PrivateAssets>

sample/Ardalis.Result.SampleWeb.FunctionalTests/PersonControllerDelete.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88

99
namespace Ardalis.Result.SampleWeb.FunctionalTests;
1010

11-
public class PersonControllerDelete : IClassFixture<WebApplicationFactory<Startup>>
11+
public class PersonControllerDelete : IClassFixture<WebApplicationFactory<WebMarker>>
1212
{
1313
private const string MEDIATR_CONTROLLER_POST_ROUTE = "/mediatr/person/remove/{0}";
1414
private const string CONTROLLER_POST_ROUTE = "/person/remove/{0}";
1515
private const string ENDPOINT_POST_ROUTE = "/person/delete/{0}";
1616

1717
private readonly HttpClient _client;
1818

19-
public PersonControllerDelete(WebApplicationFactory<Startup> factory)
19+
public PersonControllerDelete(WebApplicationFactory<WebMarker> factory)
2020
{
2121
_client = factory.CreateClient();
2222
}

sample/Ardalis.Result.SampleWeb.FunctionalTests/WeatherForecastControllerPost.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313

1414
namespace Ardalis.Result.SampleWeb.FunctionalTests;
1515

16-
public class WeatherForecastControllerPost : IClassFixture<WebApplicationFactory<Startup>>
16+
public class WeatherForecastControllerPost : IClassFixture<WebApplicationFactory<WebMarker>>
1717
{
1818
private const string CONTROLLER_POST_ROUTE = "/weatherforecast/create";
1919
private const string ENDPOINT_POST_ROUTE = "/forecast/new";
2020
private readonly HttpClient _client;
2121

22-
public WeatherForecastControllerPost(WebApplicationFactory<Startup> factory)
22+
public WeatherForecastControllerPost(WebApplicationFactory<WebMarker> factory)
2323
{
2424
_client = factory.CreateClient();
2525
}

sample/Ardalis.Result.SampleWeb/Ardalis.Result.SampleWeb.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net7.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>
88
<PackageReference Include="Ardalis.ApiEndpoints" Version="4.0.1" />
9-
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="11.0.0" />
10-
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.11" />
9+
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="11.1.0" />
10+
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.4" />
1111
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
1212
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.5.0" />
1313
</ItemGroup>

sample/Ardalis.Result.SampleWeb/Pages/Index.cshtml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</p>
2121
<p>WeatherForecast:</p>
2222
<ul>
23-
<li>PostalCode 55555 should work (200 OK)</li>
23+
<li>PostalCode 55555 should work (201 Created)</li>
2424
<li>PostalCode "" should fail (400 Bad Request with error list (required))</li>
2525
<li>PostalCode "NotFound" should return (404 Not Found)</li>
2626
<li>PostalCode "This is too long." should return (400 Bad Request with error list)</li>
+64-13
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,70 @@
1+
using Ardalis.Result;
2+
using Ardalis.Result.AspNetCore;
3+
using Ardalis.Result.Sample.Core.Services;
4+
using Ardalis.Result.SampleWeb.MediatrApi;
5+
using MediatR;
6+
using Microsoft.AspNetCore.Builder;
17
using Microsoft.AspNetCore.Hosting;
8+
using Microsoft.AspNetCore.Localization;
9+
using Microsoft.Extensions.DependencyInjection;
210
using Microsoft.Extensions.Hosting;
11+
using Microsoft.Extensions.Options;
12+
using System.Collections.Generic;
13+
using System.Globalization;
14+
using System.Net;
315

4-
namespace Ardalis.Result.SampleWeb;
16+
var builder = WebApplication.CreateBuilder(args);
517

6-
public class Program
18+
var webAssembly = typeof(Program).Assembly;
19+
builder.Services.AddMediatR(webAssembly);
20+
builder.Services.AddTransient(typeof(IPipelineBehavior<,>), typeof(LoggingBehavior<,>));
21+
22+
builder.Services.AddControllers(mvcOptions => mvcOptions
23+
.AddResultConvention(resultStatusMap => resultStatusMap
24+
.AddDefaultMap()
25+
.For(ResultStatus.Ok, HttpStatusCode.OK, resultStatusOptions => resultStatusOptions
26+
.For("POST", HttpStatusCode.Created)
27+
.For("DELETE", HttpStatusCode.NoContent))
28+
.Remove(ResultStatus.Forbidden)
29+
.Remove(ResultStatus.Unauthorized)
30+
));
31+
32+
builder.Services.AddRazorPages();
33+
builder.Services.AddLocalization(opt => { opt.ResourcesPath = "Resources"; });
34+
builder.Services.Configure<RequestLocalizationOptions>(options =>
35+
{
36+
var supportedCultures = new List<CultureInfo>
37+
{
38+
new CultureInfo("en-US"),
39+
new CultureInfo("de-DE"),
40+
};
41+
options.DefaultRequestCulture = new RequestCulture("en-US");
42+
options.SupportedCultures = supportedCultures;
43+
options.SupportedUICultures = supportedCultures;
44+
});
45+
46+
builder.Services.AddSwaggerGen();
47+
builder.Services.AddTransient<PersonService>();
48+
builder.Services.AddTransient<WeatherService>();
49+
builder.Services.AddTransient<WeatherServiceWithExceptions>();
50+
51+
var app = builder.Build();
52+
53+
if (builder.Environment.IsDevelopment())
754
{
8-
public static void Main(string[] args)
9-
{
10-
CreateHostBuilder(args).Build().Run();
11-
}
12-
13-
public static IHostBuilder CreateHostBuilder(string[] args) =>
14-
Host.CreateDefaultBuilder(args)
15-
.ConfigureWebHostDefaults(webBuilder =>
16-
{
17-
webBuilder.UseStartup<Startup>();
18-
});
55+
app.UseDeveloperExceptionPage();
1956
}
57+
58+
app.UseHttpsRedirection();
59+
60+
app.UseRouting();
61+
app.UseSwagger();
62+
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"));
63+
64+
var options = app.Services.GetService<IOptions<RequestLocalizationOptions>>();
65+
app.UseRequestLocalization(options.Value);
66+
67+
app.MapControllers();
68+
app.MapRazorPages();
69+
70+
app.Run();

0 commit comments

Comments
 (0)