Jac*_*kal 4 c# entity-framework-core
public async Task<bool> IsParagemOnGoingAsync(int registoId)
{
return await _context.ParagensRegistos
.Where(pr => pr.RegistoId == registoId)
.Any(pr => pr.HoraFim == null);
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能使这个异步?我在谷歌上找不到任何东西...
编辑
我知道 AnyAsync();
我尝试了多次,但从来没有智能感知来添加引用。
您可以使用AnyAsync()
public async Task<bool> IsParagemOnGoingAsync(int registoId)
{
return await _context.ParagensRegistos
.Where(pr => pr.RegistoId == registoId)
.AnyAsync(pr => pr.HoraFim == null);
}
Run Code Online (Sandbox Code Playgroud)
更多信息请参见AnyAsync() 这里