我正在一个 DbSet<T>
上使用 LINQ 查询:
await _dbContext.Users.AnyAsync(u => u.Name == name);
然而,编译器输出以下错误:
Error CS0121: The call is ambiguous between the following methods or properties:
'System.Linq.AsyncEnumerable.AnyAsync<TSource>(System.Collections.Generic.IAsyncEnumerable<TSource>, System.Func<TSource, bool>)' and
'Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.AnyAsync<TSource>(System.Linq.IQueryable<TSource>, System.Linq.Expressions.Expression<System.Func<TSource, bool>>)'
其他LINQ扩展方法,如.Where()
也存在类似的问题。
我正在使用EF.Core 3.1,并安装了System.Linq.Async
包。我该如何解决这个问题?