Is it correct if i am using await + ToListAsync() over IQueryable which is not defined as a task

后端 未结 3 2020
忘了有多久
忘了有多久 2020-12-10 13:01

I am using asp.net MVC-5 with EF-6, and I am not sure if using await + ToListAsync is valid. For example, I have the following repository method which returns a

3条回答
  •  悲哀的现实
    2020-12-10 13:44

    You are not "awaiting a method". You are awaiting a Task, which is an awaitable.

    You call getAllScanEmailTo that returns an IQueryable on which you then call ToListAsync which returns the Task> you are awaiting.

提交回复
热议问题