diff --git a/YaeBlog.Core/Extensions/BlogApplicationExtension.cs b/YaeBlog.Core/Extensions/BlogApplicationExtension.cs index 3b75ac6..38eff99 100644 --- a/YaeBlog.Core/Extensions/BlogApplicationExtension.cs +++ b/YaeBlog.Core/Extensions/BlogApplicationExtension.cs @@ -10,9 +10,9 @@ using YamlDotNet.Serialization.NamingConventions; namespace YaeBlog.Core.Extensions; -internal static class BlogApplicationExtension +public static class BlogApplicationExtension { - public static void ConfigureBlogApplication(this BlogApplicationBuilder builder) + internal static void ConfigureBlogApplication(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/Models/BlogOptions.cs b/YaeBlog.Core/Models/BlogOptions.cs index 712cbe4..5313860 100644 --- a/YaeBlog.Core/Models/BlogOptions.cs +++ b/YaeBlog.Core/Models/BlogOptions.cs @@ -1,10 +1,10 @@ -using Microsoft.Extensions.Options; - -namespace YaeBlog.Core.Models; +namespace YaeBlog.Core.Models; public class BlogOptions { public const string OptionName = "Blog"; public required string Root { get; set; } + + public required string ProjectName { get; set; } } diff --git a/YaeBlog.Core/Services/WebApplicationHostedService.cs b/YaeBlog.Core/Services/WebApplicationHostedService.cs index 919804c..9293246 100644 --- a/YaeBlog.Core/Services/WebApplicationHostedService.cs +++ b/YaeBlog.Core/Services/WebApplicationHostedService.cs @@ -1,6 +1,8 @@ using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Options; +using YaeBlog.Core.Models; namespace YaeBlog.Core.Services; @@ -74,6 +76,8 @@ public class WebApplicationHostedService : IHostedService { _websiteBuilder.Services.AddSingleton(_ => provider.GetRequiredService()); + _websiteBuilder.Services.AddTransient(_ => + provider.GetRequiredService>().Value); }