refactor: 支持设置多个WebApplicationBuilder和WebApplication配置函数
This commit is contained in:
@@ -34,14 +34,21 @@ public static class BlogApplicationBuilderExtension
|
||||
builder.Services.AddSingleton<EssayScanService>();
|
||||
builder.Services.AddSingleton<RendererService>();
|
||||
builder.Services.AddSingleton<EssayContentService>();
|
||||
|
||||
builder.Services.AddHostedService<WebApplicationHostedService>((provider)
|
||||
=> new WebApplicationHostedService(builder.WebApplicationBuilderConfigurations,
|
||||
builder.WebApplicationConfigurations, provider));
|
||||
}
|
||||
|
||||
public static void ConfigureWebApplicationBuilder(this BlogApplicationBuilder builder,
|
||||
Action<WebApplicationBuilder> configureWebApplicationBuilder)
|
||||
{
|
||||
builder.WebApplicationBuilderConfigurations.Add(configureWebApplicationBuilder);
|
||||
}
|
||||
|
||||
public static void ConfigureWebApplication(this BlogApplicationBuilder builder,
|
||||
Action<WebApplicationBuilder> configureWebApplicationBuilder,
|
||||
Action<WebApplication> configureWebApplication)
|
||||
{
|
||||
builder.Services.AddHostedService<WebApplicationHostedService>(provider =>
|
||||
new WebApplicationHostedService(configureWebApplicationBuilder,
|
||||
configureWebApplication, provider));
|
||||
builder.WebApplicationConfigurations.Add(configureWebApplication);
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using YaeBlog.Core.Abstractions;
|
||||
using YaeBlog.Core.Builder;
|
||||
using YaeBlog.Core.Processors;
|
||||
using YaeBlog.Core.Services;
|
||||
|
||||
namespace YaeBlog.Core.Extensions;
|
||||
@@ -9,7 +10,7 @@ public static class BlogApplicationExtension
|
||||
{
|
||||
internal static void ConfigureDefaultBlogApplication(this BlogApplication application)
|
||||
{
|
||||
|
||||
//application.UsePostRenderProcessor<ImagePostRenderProcessor>();
|
||||
}
|
||||
|
||||
public static void UsePreRenderProcessor<T>(this BlogApplication application)
|
||||
|
Reference in New Issue
Block a user