CloudBuilder/CloudBuilder.Core/Application/Packs/CloudBuilderCorePack.cs
owenchen 1c0c83af5f ow
2026-05-12 10:09:31 +08:00

61 lines
2.2 KiB
C#

using CloudBuilder.Core.Application.Builders;
using CloudBuilder.Core.Application.Options;
using CloudBuilder.Core.DatabaseAccessor;
using CloudBuilder.Core.DatabaseAccessor.Entity;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CloudBuilder.Core.Application.Packs
{
/// <summary>
/// CloudBuilder核心模块
/// </summary>
[Description("CloudBuilder核心模块")]
[PackLevel(0)]
public class CloudBuilderCorePack : CloudBuilderPack
{
/// <summary>
/// 获取 模块级别
/// </summary>
public override PackLevel Level => PackLevel.Core;
/// <summary>
/// 将全局应用添加到依赖注入服务容器中
/// </summary>
/// <param name="services">依赖注入服务容器</param>
/// <returns></returns>
public override IServiceCollection AddServices(IServiceCollection services, CloudBuilderBuilder builder)
{
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
services.AddSingleton(new WebService(services));
services.AddScoped<IApplicationService, ApplicationService>();
//services.TryAddSingleton<IInputDtoTypeFinder, InputDtoTypeFinder>();
//services.TryAddSingleton<IOutputDtoTypeFinder, OutputDtoTypeFinder>();
//services.TryAddSingleton<ICancellationTokenProvider, NoneCancellationTokenProvider>();
//services.TryAddSingleton<IEmailSender, DefaultEmailSender>();
//services.TryAddSingleton<ICacheService, CacheService>();
//services.TryAddScoped<IFilterService, FilterService>();
//services.TryAddTransient<IClientHttpCrypto, ClientHttpCrypto>();
//services.AddTransient<ClientHttpCryptoHandler>();
//services.AddDistributedMemoryCache();
return services;
}
}
}