Should we use CancellationToken with MVC/Web API controllers?

后端 未结 3 1569
轮回少年
轮回少年 2020-12-29 17:51

There are different examples for async controllers. Some of them use CancellationToken in method definition:

public async Task ShowItem(i         


        
3条回答
  •  情深已故
    2020-12-29 18:49

    You should use it. Right now it only applies if you have an AsyncTimeout, but it's likely that a future MVC/WebAPI version will interpret the token as "either timeout or the client disconnected".

提交回复
热议问题