YaeBlog/YaeBlog.Core/Extensions/WebApplicationBuilderExtensions.cs
jackfiled ca4f6449d3
All checks were successful
Build blog docker image / Build-Blog-Image (push) Successful in 1m15s
feat: 使用Bootstrap重写前端页面 (#2)
Reviewed-on: #2
2024-07-22 16:59:43 +08:00

32 lines
1.1 KiB
C#

using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using YaeBlog.Core.Models;
using YaeBlog.Core.Processors;
using YaeBlog.Core.Services;
namespace YaeBlog.Core.Extensions;
public static class WebApplicationBuilderExtensions
{
public static WebApplicationBuilder AddYaeBlog(this WebApplicationBuilder builder)
{
builder.Services.Configure<BlogOptions>(builder.Configuration.GetSection(BlogOptions.OptionName));
builder.Services.AddHttpClient();
builder.Services.AddMarkdig();
builder.Services.AddYamlParser();
builder.Services.AddSingleton<EssayScanService>();
builder.Services.AddSingleton<RendererService>();
builder.Services.AddSingleton<EssayContentService>();
builder.Services.AddTransient<ImagePostRenderProcessor>();
builder.Services.AddTransient<BlogOptions>(provider =>
provider.GetRequiredService<IOptions<BlogOptions>>().Value);
builder.Services.AddHostedService<BlogHostedService>();
return builder;
}
}