ef core一直报Sequence contains more than one matching element

框架版本:.NET6
EF Core版本 5.0
System.InvalidOperationException: Sequence contains more than one matching element

System.InvalidOperationException: Sequence contains more than one matching element
  at System.Linq.ThrowHelper.ThrowMoreThanOneMatchException()
  at System.Linq.Enumerable.TryGetSingle[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
  at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
  at Microsoft.EntityFrameworkCore.Query.QueryableMethods..cctor()
  --- End of inner exception stack trace ---
  at Microsoft.EntityFrameworkCore.Query.QueryableMethods.get_FirstOrDefaultWithPredicate()
  at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.FirstOrDefaultAsync[TSource](IQueryable`1 source, Expression`1 predicate, CancellationToken cancellationToken)
  at Lmn.Express.Application.Services.Auth.AuthService.LoginAsync(CredentialDto input) in 

异常情况:ToList()的所有方法都异常了。

解决:升级EF Core为6.0版本解决

参考文档:
https://github.com/dotnet/efcore/issues/26635

你可能感兴趣的:(EF,Core,c#,ef,core)