From 99eadae6337a11e884b30fc3caa96743fcccaf15 Mon Sep 17 00:00:00 2001 From: Benjamin Michaelis Date: Fri, 23 Oct 2026 18:06:43 -0700 Subject: [PATCH] feat: use SiteMappingDescription from EssentialCSharp.Shared.Models Bump the tooling packages to 1.1.1.19570 and replace the private ChapterDescription record with the shared SiteMappingDescription type that the tooling serializes. --- Directory.Packages.props | 2 +- EssentialCSharp.Web/Services/ChapterDescriptionService.cs | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index f0671a80..13dba90d 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -2,7 +2,7 @@ true false - 1.1.1.19562 + 1.1.1.19570 false diff --git a/EssentialCSharp.Web/Services/ChapterDescriptionService.cs b/EssentialCSharp.Web/Services/ChapterDescriptionService.cs index 48fa519c..f4cc60bb 100644 --- a/EssentialCSharp.Web/Services/ChapterDescriptionService.cs +++ b/EssentialCSharp.Web/Services/ChapterDescriptionService.cs @@ -16,10 +16,10 @@ public ChapterDescriptionService(IWebHostEnvironment environment) } using FileStream stream = File.OpenRead(path); - List entries = JsonSerializer.Deserialize>(stream) + List entries = JsonSerializer.Deserialize>(stream) ?? throw new InvalidDataException($"No chapter descriptions found in {path}"); Dictionary descriptions = new(StringComparer.OrdinalIgnoreCase); - foreach (ChapterDescription entry in entries) + foreach (SiteMappingDescription entry in entries) { foreach (string key in entry.Keys) { @@ -42,6 +42,4 @@ public string GetDescription(SiteMapping mapping) string heading = mapping.IndentLevel == 0 ? mapping.ChapterTitle : mapping.RawHeading; return $"Learn about {heading} in Essential C# with practical examples and explanations from the online C# guide."; } - - private sealed record ChapterDescription(List Keys, string Value); }