【发布时间】:2014-03-23 23:54:08
【问题描述】:
当我们在 MVC 中使用如下示例中的异步操作时,发布模型数据在视图中早于 10 秒可用(此处为 1 秒)?我很困惑,如何在 1 秒内获得数据而获取数据需要 10 秒???
例如:
public async Task<ActionResult> GetPosts()
{
// ...
IPost posts = await PostService.GetPosts();// assume this take 10 seconds
// ...
return View(model: posts);//BUT we return in 1 second! How posts model available in view for show to the user earlier than 10 seconds?
}
【问题讨论】:
标签: c# asp.net asp.net-mvc async-await asp.net-mvc-5