正如您在错误行下方看到的那样,除了#号以外,两个AnonymousType0文本几乎相同。#号是什么意思?
(错误重新格式化以使其更易于阅读)
无法转换类型的对象
'Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable`1[ <>f__AnonymousType0#1`6[System.String,System.String,System.String, System.Int32,System.Decimal,System.Double]]'
输入
'System.Linq.IQueryable`1[ <>f__AnonymousType0`6[System.String,System.String,System.String, System.Int32,System.Decimal,System.Double]]'
从这两个问题来看
尝试返回IQueryable <MyType>时发生转换错误
和
合并两个EF查询,无法将类型为System.Data.Entity.Infrastructure.DbQuery的对象转换为System.Collections.Generic.IEnumerable
您可能无法进行转换,因为您的匿名类型彼此不完全匹配(因此,#1可能表示这不是同一类型)。
尝试检查这两种类型是否具有完全相同的属性集(相同的类型和相同的名称;没有在一种类型中声明但在另一种类型中声明的其他属性)。
祝好运!
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句