Skip to content

Commit bc46020

Browse files
committed
Merge branch 'release/5.2.0' into master
OnTopic 5.2.0 introduces support for response caching (#89), a new `ErrorController` for HTTP error codes (#91), and improvements to `ITopicMappingService` performance via optional `AttributeDictionary` constructors (#99), updates to the internal reflection libraries (#90), and caching of compatible properties (#102). In addition, it also includes a number of internal code improvements, such as adoption of new C# 10 capabilities (#96), including global using directives (#93).
2 parents a4e8598 + e4d5545 commit bc46020

File tree

292 files changed

+5520
-3265
lines changed

Some content is hidden

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

292 files changed

+5520
-3265
lines changed

Directory.Build.props

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
<Project>
22

33
<PropertyGroup>
4-
<LangVersion>9.0</LangVersion>
4+
<LangVersion>10.0</LangVersion>
55
<Nullable>enable</Nullable>
66
<AnalysisLevel>latest</AnalysisLevel>
77
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
8+
<ImplicitUsings>enable</ImplicitUsings>
89
</PropertyGroup>
910

1011
<PropertyGroup>
1112
<Company>Ignia</Company>
1213
<Product>OnTopic</Product>
13-
<Copyright2021 Ignia, LLC</Copyright>
14+
<Copyright2022 Ignia, LLC</Copyright>
1415
<Authors>Ignia</Authors>
1516
<PackageProjectUrl>https://github.com/Ignia/Topics-Library</PackageProjectUrl>
1617
<UseFullSemVerForNuGet>true</UseFullSemVerForNuGet>

OnTopic.All/OnTopic.All.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="GitVersion.MsBuild" Version="5.6.8">
14+
<PackageReference Include="GitVersion.MsBuild" Version="5.10.3">
1515
<PrivateAssets>all</PrivateAssets>
1616
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1717
</PackageReference>

OnTopic.All/Properties/AssemblyInfo.cs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
| Client Ignia, LLC
44
| Project Topics Library
55
\=============================================================================================================================*/
6-
using System;
76
using System.Runtime.InteropServices;
87

98
/*==============================================================================================================================

OnTopic.AspNetCore.Mvc.Host/OnTopic.AspNetCore.Mvc.Host.csproj

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

33
<PropertyGroup>
4-
<TargetFramework>net5.0</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
<UserSecretsId>62eb85bf-f802-4afd-8bec-3d344e1cfc79</UserSecretsId>
66
<IsPackable>false</IsPackable>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="5.0.3">
10+
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0">
1111
<PrivateAssets>all</PrivateAssets>
1212
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1313
</PackageReference>

OnTopic.AspNetCore.Mvc.Host/Program.cs

+88-40
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,91 @@
33
| Client Ignia, LLC
44
| Project Sample OnTopic Site
55
\=============================================================================================================================*/
6-
using System;
7-
using System.Diagnostics.CodeAnalysis;
8-
using Microsoft.AspNetCore.Hosting;
9-
using Microsoft.Extensions.Hosting;
10-
11-
namespace OnTopic.AspNetCore.Mvc.Host {
12-
13-
/*============================================================================================================================
14-
| CLASS: PROGRAM
15-
\---------------------------------------------------------------------------------------------------------------------------*/
16-
/// <summary>
17-
/// The <see cref="Program"/> class—and it's <see cref="Program.Main(String[])"/> method—represent the entry point into the
18-
/// ASP.NET Core web application.
19-
/// </summary>
20-
[ExcludeFromCodeCoverage]
21-
public static class Program {
22-
23-
/*==========================================================================================================================
24-
| METHOD: MAIN
25-
\-------------------------------------------------------------------------------------------------------------------------*/
26-
/// <summary>
27-
/// Responsible for bootstrapping the web application.
28-
/// </summary>
29-
public static void Main(string[] args) => CreateHostBuilder(args).Build().Run();
30-
31-
/*==========================================================================================================================
32-
| METHOD: CREATE WEB HOST BUILDER
33-
\-------------------------------------------------------------------------------------------------------------------------*/
34-
/// <summary>
35-
/// Configures a new <see cref="IWebHostBuilder"/> with the default options.
36-
/// </summary>
37-
public static IHostBuilder CreateHostBuilder(string[] args) =>
38-
Microsoft.Extensions.Hosting.Host
39-
.CreateDefaultBuilder(args)
40-
.ConfigureWebHostDefaults(webBuilder => {
41-
webBuilder.UseStartup<Startup>();
42-
});
43-
44-
} //Class
45-
} //Namespace
6+
using Microsoft.AspNetCore.Mvc.Controllers;
7+
using Microsoft.AspNetCore.Mvc.ViewComponents;
8+
using OnTopic.AspNetCore.Mvc;
9+
using OnTopic.AspNetCore.Mvc.Host;
10+
11+
#pragma warning disable CA1812 // Avoid uninstantiated internal classes
12+
13+
/*==============================================================================================================================
14+
| CONFIGURE SERVICES
15+
\-----------------------------------------------------------------------------------------------------------------------------*/
16+
var builder = WebApplication.CreateBuilder(args);
17+
18+
/*------------------------------------------------------------------------------------------------------------------------------
19+
| Configure: Cookie Policy
20+
\-----------------------------------------------------------------------------------------------------------------------------*/
21+
builder.Services.Configure<CookiePolicyOptions>(options => {
22+
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
23+
options.CheckConsentNeeded = context => true;
24+
options.MinimumSameSitePolicy = SameSiteMode.None;
25+
});
26+
27+
/*------------------------------------------------------------------------------------------------------------------------------
28+
| Configure: Output Caching
29+
\-----------------------------------------------------------------------------------------------------------------------------*/
30+
builder.Services.AddResponseCaching();
31+
32+
/*------------------------------------------------------------------------------------------------------------------------------
33+
| Configure: MVC
34+
\-----------------------------------------------------------------------------------------------------------------------------*/
35+
builder.Services.AddControllersWithViews()
36+
37+
//Add OnTopic support
38+
.AddTopicSupport();
39+
40+
/*------------------------------------------------------------------------------------------------------------------------------
41+
| Register: Activators
42+
\-----------------------------------------------------------------------------------------------------------------------------*/
43+
var activator = new SampleActivator(builder.Configuration.GetConnectionString("OnTopic"));
44+
45+
builder.Services.AddSingleton<IControllerActivator>(activator);
46+
builder.Services.AddSingleton<IViewComponentActivator>(activator);
47+
48+
/*==============================================================================================================================
49+
| CONFIGURE APPLICATION
50+
\-----------------------------------------------------------------------------------------------------------------------------*/
51+
var app = builder.Build();
52+
53+
/*------------------------------------------------------------------------------------------------------------------------------
54+
| Configure: Error Pages
55+
\-----------------------------------------------------------------------------------------------------------------------------*/
56+
app.UseStatusCodePagesWithReExecute("/Error/{0}/");
57+
if (!app.Environment.IsDevelopment()) {
58+
app.UseExceptionHandler("/Error/500/");
59+
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
60+
app.UseHsts();
61+
}
62+
63+
/*------------------------------------------------------------------------------------------------------------------------------
64+
| Configure: Server defaults
65+
\-----------------------------------------------------------------------------------------------------------------------------*/
66+
app.UseHttpsRedirection();
67+
app.UseStaticFiles();
68+
app.UseCookiePolicy();
69+
app.UseRouting();
70+
app.UseCors("default");
71+
app.UseResponseCaching();
72+
73+
/*------------------------------------------------------------------------------------------------------------------------------
74+
| Configure: MVC
75+
\-----------------------------------------------------------------------------------------------------------------------------*/
76+
app.MapImplicitAreaControllerRoute(); // {area:exists}/{action=Index}
77+
app.MapDefaultAreaControllerRoute(); // {area:exists}/{controller}/{action=Index}/{id?}
78+
app.MapTopicAreaRoute(); // {area:exists}/{**path}
79+
80+
app.MapTopicErrors(includeStaticFiles: false); // Error/{statusCode}
81+
app.MapDefaultControllerRoute(); // {controller=Home}/{action=Index}/{id?}
82+
app.MapTopicRoute(rootTopic: "Web"); // Web/{**path}
83+
app.MapTopicRoute(rootTopic: "Error"); // Error/{**path}
84+
app.MapTopicSitemap(); // Sitemap
85+
app.MapTopicRedirect(); // Topic/{topicId}
86+
app.MapControllers();
87+
88+
/*------------------------------------------------------------------------------------------------------------------------------
89+
| Run application
90+
\-----------------------------------------------------------------------------------------------------------------------------*/
91+
app.Run();
92+
93+
#pragma warning restore CA1812 // Avoid uninstantiated internal classes

OnTopic.AspNetCore.Mvc.Host/Properties/AssemblyInfo.cs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
| Client Ignia, LLC
44
| Project Topics Library
55
\=============================================================================================================================*/
6-
using System;
76
using System.Runtime.InteropServices;
87

98
/*==============================================================================================================================

OnTopic.AspNetCore.Mvc.Host/SampleActivator.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
| Client Ignia, LLC
44
| Project Sample OnTopic Site
55
\=============================================================================================================================*/
6-
using System;
76
using System.Diagnostics.CodeAnalysis;
87
using Microsoft.AspNetCore.Mvc;
98
using Microsoft.AspNetCore.Mvc.Controllers;
@@ -118,6 +117,8 @@ public object Create(ControllerContext context) {
118117
return type.Name switch {
119118
nameof(TopicController) =>
120119
new TopicController(_topicRepository, _topicMappingService),
120+
nameof(ErrorController) =>
121+
new ErrorController(_topicRepository, _topicMappingService),
121122
nameof(SitemapController) =>
122123
new SitemapController(_topicRepository),
123124
nameof(RedirectController) =>

OnTopic.AspNetCore.Mvc.Host/Startup.cs

-126
This file was deleted.

OnTopic.AspNetCore.Mvc.IntegrationTests.Host/Areas/Area/Controllers/AreaController.cs

-3
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@
33
| Client Ignia, LLC
44
| Project Topics Library
55
\=============================================================================================================================*/
6-
using System.Diagnostics.CodeAnalysis;
76
using Microsoft.AspNetCore.Mvc;
8-
using Microsoft.AspNetCore.Routing;
97
using OnTopic.AspNetCore.Mvc.Controllers;
108
using OnTopic.Mapping;
11-
using OnTopic.Repositories;
129

1310
namespace OnTopic.AspNetCore.Mvc.IntegrationTests.Areas.Area.Controllers {
1411

OnTopic.AspNetCore.Mvc.IntegrationTests.Host/OnTopic.AspNetCore.Mvc.IntegrationTests.Host.csproj

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

33
<PropertyGroup>
4-
<TargetFramework>net5.0</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
<IsPackable>false</IsPackable>
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="5.0.3">
9+
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0">
1010
<PrivateAssets>all</PrivateAssets>
1111
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1212
</PackageReference>

OnTopic.AspNetCore.Mvc.IntegrationTests.Host/Program.cs

-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
| Client Ignia, LLC
44
| Project Integration Tests Host
55
\=============================================================================================================================*/
6-
using System;
7-
using System.Diagnostics.CodeAnalysis;
8-
using Microsoft.AspNetCore.Hosting;
9-
using Microsoft.Extensions.Hosting;
106

117
namespace OnTopic.AspNetCore.Mvc.IntegrationTests.Host {
128

OnTopic.AspNetCore.Mvc.IntegrationTests.Host/Properties/AssemblyInfo.cs

+11-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,17 @@
33
| Client Ignia, LLC
44
| Project Topics Library
55
\=============================================================================================================================*/
6-
using System;
7-
using System.Diagnostics.CodeAnalysis;
6+
7+
/*==============================================================================================================================
8+
| USING DIRECTIVES (GLOBAL)
9+
\-----------------------------------------------------------------------------------------------------------------------------*/
10+
global using System.Diagnostics.CodeAnalysis;
11+
global using OnTopic.Internal.Diagnostics;
12+
global using OnTopic.Repositories;
13+
14+
/*==============================================================================================================================
15+
| USING DIRECTIVES (LOCAL)
16+
\-----------------------------------------------------------------------------------------------------------------------------*/
817
using System.Runtime.InteropServices;
918

1019
/*==============================================================================================================================

0 commit comments

Comments
 (0)