通话方式:
public async Task<int> ExecuteJob(RequestParam param)
{
await Task.Run(() =>
{
result = package.Execute();
jobResult = (int)result;
});
return jobResult;
}
调用方法:
await Task.Run(() =>
{
result = package.Execute();
jobResult = (int)result;
if(result == ssisruntime.DTSExecResult.Success)
return jobResult;
});
一旦包完成,它应该返回到调用方法,我们怎样才能实现呢?因为在等待中,我无法使用如下所示的返回,
COUNT
请有人帮忙。
答案 0 :(得分:3)
也许是这样的:
internal async Task<object> ExecuteJobAsync(RequestParam inputParam)
{
bool jobStatus = false;
var result = await jobManager.ExecuteJob(inputParam);
// Code continues
}
public Task<int> ExecuteJob(RequestParam param)
{
return Task.Run<int>(() =>
{
return (int)package.Execute();
});
}