-
Notifications
You must be signed in to change notification settings - Fork 446
/
Copy pathActionTask.cs
37 lines (34 loc) · 1.15 KB
/
ActionTask.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System.Threading.Tasks;
namespace WebApiClientCore.Implementations.Tasks
{
/// <summary>
/// 表示Api请求的任务
/// </summary>
/// <typeparam name="TResult">结果类型</typeparam>
sealed class ActionTask<TResult> : TaskBase<TResult>
{
private readonly DefaultApiActionInvoker<TResult> invoker;
private readonly HttpClientContext context;
private readonly object?[] arguments;
/// <summary>
/// Api请求的任务
/// </summary>
/// <param name="invoker"></param>
/// <param name="context"></param>
/// <param name="arguments"></param>
public ActionTask(DefaultApiActionInvoker<TResult> invoker, HttpClientContext context, object?[] arguments)
{
this.invoker = invoker;
this.context = context;
this.arguments = arguments;
}
/// <summary>
/// 创建新的请求任务
/// </summary>
/// <returns></returns>
protected override Task<TResult> InvokeAsync()
{
return this.invoker.InvokeAsync(this.context, this.arguments);
}
}
}