Entity Framework Core 如何使任何异步? [英] Entity Framework Core how to make Any Async?

查看:34
本文介绍了Entity Framework Core 如何使任何异步?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

    public async Task<bool> IsParagemOnGoingAsync(int registoId)
    {
       return await _context.ParagensRegistos
           .Where(pr => pr.RegistoId == registoId)
           .Any(pr => pr.HoraFim == null);
    }

how can i make this async? I can't find anythig on google...

EDIT

I knew about AnyAsync();

I tried like multiple times and never had intellisense to add the reference.

解决方案

You can use AnyAsync()

 public async Task<bool> IsParagemOnGoingAsync(int registoId)
    {
       return await _context.ParagensRegistos
           .Where(pr => pr.RegistoId == registoId)
           .AnyAsync(pr => pr.HoraFim == null);
    }

More info on AnyAsync() here

这篇关于Entity Framework Core 如何使任何异步?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆