我正在尝试选择一个整数列表,它引发了一个异常。
异常消息:System.ArgumentException:“System.Collections.Generic.IAsyncEnumerable1[System.Int32]”类型的表达式不能用于方法“System.Collections.Generic.IAsyncEnumerable1[System.Object]”类型的参数。 Collections.Generic.IAsyncEnumerable1[MyProject.Model.Entities.MyTable] CastModel' 参数名称:arg0
重现步骤
模型
public class MyTable {
public int MyTableId { get; set; }
public int SomeKey { get; set; }
public int MyFieldIntegerIWant { get; set; }
}
运行下面的查询(或类似的查询):
int keyId;
var ids = await context.MyTable.AsNoTracking()
.Where(x => x.SomeKey.Equals(keyId))
.Select(x => x.MyFieldIntegerIWant)
.ToListAsync();
更多技术细节
EF 核心版本:1.1.0
数据库提供程序:Microsoft.EntityFrameworkCore.SqlServer
操作系统:Windows 7
IDE:Visual Studio 2015
更新:
The issue had something to do with EF Plus' QueryFilters
https://github.com/zzzprojects/EntityFramework-Plus/issues/133