Skip to content

Commit 1a2961c

Browse files
committed
添加 AddResumeFileResult 方法以支持断点续传服务
在 ServiceCollectionExtensions.cs 文件中进行了以下修改: - 移除了 `using NewLife.Model;` 语句。 - 添加了多个 `using` 语句,包括 `Microsoft.AspNetCore.Mvc.Infrastructure` 和 `Pek.ResumeFileResult.Executor` 等。 - 在 `ServiceCollectionExtensions` 类中添加了 `AddResumeFileResult` 方法,用于注入断点续传服务。 - 使用 `TryAddSingleton` 方法将多个 `IActionResultExecutor` 服务添加为单例服务。 - 添加了 `AddResumeFileResult` 方法的 XML 注释,描述了该方法的功能和参数。
1 parent 07f955e commit 1a2961c

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

Pek.AspNetCore/Infrastructure/ServiceCollectionExtensions.cs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1-
using NewLife.Model;
1+
using Microsoft.AspNetCore.Mvc.Infrastructure;
2+
using Microsoft.Extensions.DependencyInjection.Extensions;
3+
4+
using NewLife.Model;
5+
6+
using Pek.ResumeFileResult;
7+
using Pek.ResumeFileResult.Executor;
28

39
namespace Pek.Infrastructure;
410

11+
/// <summary>
12+
/// 依赖注入ServiceCollection容器扩展方法
13+
/// </summary>
514
public static class ServiceCollectionExtensions
615
{
716
/// <summary>
@@ -48,4 +57,20 @@ public static void AddAllSingletons(this IServiceCollection services)
4857

4958
ObjectContainer.Provider = services.BuildServiceProvider();
5059
}
60+
61+
/// <summary>
62+
/// 注入断点续传服务
63+
/// </summary>
64+
/// <param name="services"></param>
65+
/// <returns></returns>
66+
public static IServiceCollection AddResumeFileResult(this IServiceCollection services)
67+
{
68+
services.TryAddSingleton<IActionResultExecutor<ResumePhysicalFileResult>, ResumePhysicalFileResultExecutor>();
69+
services.TryAddSingleton<IActionResultExecutor<ResumeVirtualFileResult>, ResumeVirtualFileResultExecutor>();
70+
services.TryAddSingleton<IActionResultExecutor<ResumeFileStreamResult>, ResumeFileStreamResultExecutor>();
71+
services.TryAddSingleton<IActionResultExecutor<ResumeFileContentResult>, ResumeFileContentResultExecutor>();
72+
return services;
73+
}
74+
75+
5176
}

0 commit comments

Comments
 (0)