2024-08-09 00:16:40 +08:00
|
|
|
|
using Bunny.Common.EFCore;
|
2024-08-08 22:56:53 +08:00
|
|
|
|
using Bunny.Service.IService;
|
2024-08-08 22:51:21 +08:00
|
|
|
|
using Bunny.Service.IService.Service;
|
2024-08-09 00:16:40 +08:00
|
|
|
|
using Bunny.WebApi.Controllers;
|
2024-08-08 22:51:21 +08:00
|
|
|
|
|
|
|
|
|
namespace Bunny.WebApi.Config;
|
|
|
|
|
|
|
|
|
|
public static class ServiceRegistration
|
|
|
|
|
{
|
2024-08-09 00:16:40 +08:00
|
|
|
|
public static void AddApplicationController(this WebApplicationBuilder builder)
|
2024-08-08 22:51:21 +08:00
|
|
|
|
{
|
2024-08-09 00:16:40 +08:00
|
|
|
|
builder.Services.AddScoped<IndexController>();
|
2024-08-08 22:51:21 +08:00
|
|
|
|
builder.Services.AddScoped<TemplateController>();
|
2024-08-09 00:16:40 +08:00
|
|
|
|
builder.Services.AddScoped<BlogController>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void AddApplicationServices(this WebApplicationBuilder builder)
|
|
|
|
|
{
|
|
|
|
|
builder.Services.AddScoped<EfCoreContext>();
|
2024-08-08 22:51:21 +08:00
|
|
|
|
builder.Services.AddScoped<IBaseService, BaseService>();
|
2024-08-09 00:16:40 +08:00
|
|
|
|
builder.Services.AddScoped<IBlogService, BlogService>();
|
2024-08-08 22:51:21 +08:00
|
|
|
|
}
|
2024-08-09 00:16:40 +08:00
|
|
|
|
|
2024-08-08 22:56:53 +08:00
|
|
|
|
/// <summary>
|
2024-08-09 00:16:40 +08:00
|
|
|
|
/// 注入后台服务相关
|
2024-08-08 22:56:53 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="builder"></param>
|
|
|
|
|
public static void AddApplicationBackendServices(this WebApplicationBuilder builder)
|
|
|
|
|
{
|
|
|
|
|
// 测试注入后台服务
|
|
|
|
|
// builder.Services.AddHostedService<TemplateBackgroundModule>();
|
|
|
|
|
}
|
2024-08-09 00:16:40 +08:00
|
|
|
|
}
|