diff --git a/YaeBlog.Core/Builder/BlogApplicationBuilder.cs b/YaeBlog.Core/Builder/BlogApplicationBuilder.cs index 0b18ee1..0d358ab 100644 --- a/YaeBlog.Core/Builder/BlogApplicationBuilder.cs +++ b/YaeBlog.Core/Builder/BlogApplicationBuilder.cs @@ -31,8 +31,10 @@ public sealed class BlogApplicationBuilder : IHostApplicationBuilder public BlogApplication Build() { - this.ConfigureBlogApplication(); - return new BlogApplication(_hostApplicationBuilder.Build()); + this.ConfigureDefaultBlogApplicationBuilder(); + BlogApplication application = new(_hostApplicationBuilder.Build()); + application.ConfigureDefaultBlogApplication(); + return application; } public void ConfigureContainer( diff --git a/YaeBlog.Core/Extensions/BlogApplicationBuilderExtension.cs b/YaeBlog.Core/Extensions/BlogApplicationBuilderExtension.cs index e17927c..84d2ed4 100644 --- a/YaeBlog.Core/Extensions/BlogApplicationBuilderExtension.cs +++ b/YaeBlog.Core/Extensions/BlogApplicationBuilderExtension.cs @@ -12,7 +12,7 @@ namespace YaeBlog.Core.Extensions; public static class BlogApplicationBuilderExtension { - internal static void ConfigureBlogApplication(this BlogApplicationBuilder builder) + internal static void ConfigureDefaultBlogApplicationBuilder(this BlogApplicationBuilder builder) { builder.Configuration.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true); builder.Configuration.AddJsonFile($"appsettings.{builder.Environment.EnvironmentName}.json", diff --git a/YaeBlog.Core/Extensions/BlogApplicationExtension.cs b/YaeBlog.Core/Extensions/BlogApplicationExtension.cs index a7de84b..18e99ac 100644 --- a/YaeBlog.Core/Extensions/BlogApplicationExtension.cs +++ b/YaeBlog.Core/Extensions/BlogApplicationExtension.cs @@ -7,6 +7,11 @@ namespace YaeBlog.Core.Extensions; public static class BlogApplicationExtension { + internal static void ConfigureDefaultBlogApplication(this BlogApplication application) + { + + } + public static void UsePreRenderProcessor(this BlogApplication application) where T : IPreRenderProcessor { diff --git a/YaeBlog.Core/Models/BlogEssay.cs b/YaeBlog.Core/Models/BlogEssay.cs index 08a3833..5927d64 100644 --- a/YaeBlog.Core/Models/BlogEssay.cs +++ b/YaeBlog.Core/Models/BlogEssay.cs @@ -16,6 +16,22 @@ public class BlogEssay public required string HtmlContent { get; init; } + public BlogEssay WithNewHtmlContent(string newHtmlContent) + { + var essay = new BlogEssay + { + Title = Title, + FileName = FileName, + PublishTime = PublishTime, + Description = Description, + WordCount = WordCount, + HtmlContent = newHtmlContent + }; + essay.Tags.AddRange(Tags); + + return essay; + } + public override string ToString() { return $"{Title}-{PublishTime}";