EF异步查询报错:The provider for the source 'IQueryable' doesn't implement 'IAsyncQueryProvider'
The provider for the source 'IQueryable' doesn't implement 'IAsyncQueryProvider'. Only providers that implement 'IAsyncQueryProvider' can be used for Entity Framework asynchronous operations.
C# 全选
var obj = await q.Where(w => w.UserCode == appId).FirstOrDefaultAsync();
原因是使用了 EntityFrameworkCore 的 EntityFrameworkQueryableExtensions 扩展类的FirstOrDefaultAsync()扩展方法。
解决方案
将 Using Microsoft.EntityFrameworkCore; 改为 using System.Data.Entity;
版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网