无法创建类型为'System.Collections.Generic.IEnumerable'1'的空常量值

Sksallaj

无法创建类型为'System.Collections.Generic.IEnumerable'1'的空常量值。在此上下文中,仅支持实体类型,枚举类型或原始类型。“} System.SystemException {System.NotSupportedException}

我真的很困惑为什么这不起作用。两者都在query.ZipCodes中包含东西,zipCodeDistribList中包含东西,distribQuery中包含东西。所以我在这里完全不知所措。

if (query.States.Any())
{
    var statesDistribList =
        (from selectedState in query.States
         join distribStateXREF in LocationEntityProvider.Context.MD_DISTRB_ST_XREF
            on selectedState equals distribStateXREF.ST_CD
         select distribStateXREF.MD_DISTRB_NBR
         ) ?? new List<decimal>();

    if (statesDistribList.Any())
    {
        distribQuery = distribQuery.Where(distrib => statesDistribList.Contains(distrib.Number));
    }
    statesDistribList = null;
}

query.States是IEnumerable的distribQuery是IEnumerable的StatesDistribList参见上面的代码

该错误发生在distribQuery上,后者具有早期查询中的内容;所以我知道null根本不是这里的根本问题。

斯拉克斯
statesDistribList = null

您的查询仅在此行之后执行。
因此,它为空。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

IQueryable Union,无法创建类型为'System.Collections.Generic.IEnumerable`1 [[System.Int32

来自分类Dev

无法将类型为“ System.Collections.Generic.List`1 Models.Hospitals”的对象转换为类型为“ System.Collections.Generic.IEnumerable”的对象

来自分类Dev

MVC:字典需要类型为'System.Collections.Generic.IEnumerable`1的模型项

来自分类Dev

MVC:字典需要类型为'System.Collections.Generic.IEnumerable`1的模型项

来自分类Dev

无法将类型为“ System.Data.Entity.DbSet” [City]的对象转换为类型为“ System.Collections.Generic.IEnumerable`1 [System.Web.Mvc.SelectListItem]”的对象

来自分类Dev

无法将类型'System.Collections.Generic.IEnumerable <AnonymousType#1>'隐式转换为'System.Collections.Generic.IEnumerable <T>

来自分类Dev

如何声明类型为System.Collections.Generic.IEnumerable的变量?

来自分类Dev

无法隐式转换类型'System.Collections.Generic.IEnumerable

来自分类Dev

无法隐式转换类型'System.Collections.Generic.IEnumerable <System.Collections.Generic.ICollection

来自分类Dev

无法将类型为“ System.Collections.ArrayList”的对象转换为类型为“ System.Collections.Generic.IEnumerable”

来自分类Dev

无法将类型'System.Linq.IQueryable <AnonymousType#1>'隐式转换为'System.Collections.Generic.IEnumerable <SubCateViewModel>'

来自分类Dev

无法将类型System.Collections.Generic.Ienumerable <string>隐式转换为system.Linq.IOrderedEnumerable <AnonymousType#1>

来自分类Dev

无法将类型'System.Collections.Generic.IEnumerable隐式转换为System.Collections.Generic.IEnumerable <TiendaDeportes.producto>

来自分类Dev

无法将类型'Task <System.Collections.Generic.IEnumerable <IClass >>隐式转换为'System.Collections.Generic.IEnumerable <IClass>

来自分类Dev

'System.Collections.Generic.List`1[<>f__AnonymousType1 但这个字典需要一个'System.Collections.Generic.IEnumerable ERROR 类型的模型项

来自分类Dev

C#JSON错误=>无法将JSON对象反序列化为类型'System.Collections.Generic.IEnumerable`1

来自分类Dev

无法从System.Collections.Generic.List转换为System.Collections.Generic.IEnumerable

来自分类Dev

无法从'System.Collections.Generic.IEnumerable <char>'转换为'string'

来自分类Dev

无法从'string'转换为'System.Collections.Generic.IEnumerable <string>

来自分类Dev

无法将类型System.Collections.Generic.List <IEnumerable>隐式转换为<IEnumerable

来自分类Dev

错误“无法将类型“System.Collections.Generic.IEnumerable<int>”隐式转换为“System.Collections.Generic.List<int>”

来自分类Dev

无法将类型System.Linq.IQueryable隐式转换为System Collections.Generic.IEnumerable

来自分类Dev

字典需要一个“System.Collections.Generic.IEnumerable`1[ShimbaSchool.Models.EventMessageDepartment]”类型的模型项

来自分类Dev

system.collections.generic.IEnumerable 错误

来自分类Dev

无法将类型'System.Collections.Generic.IEnumerable <string>隐式转换为字符串

来自分类Dev

ASP.NET LINQ错误无法创建类型为'System.Collections.Generic.List`1 [System.Int32]'的查询结果

来自分类Dev

Dapper:找不到方法:'System.Collections.Generic.IEnumerable`1 <!! 0> GridReader.Read(Boolean)'

来自分类Dev

SignalR:无法从System.String强制转换或转换为System.Collections.Generic.IEnumerable

来自分类Dev

无法将类型'System.Collections.Generic.List <String>'隐式转换为'System.Collections.Generic.IEnumerable <turon.Model.Products_Products>

Related 相关文章

  1. 1

    IQueryable Union,无法创建类型为'System.Collections.Generic.IEnumerable`1 [[System.Int32

  2. 2

    无法将类型为“ System.Collections.Generic.List`1 Models.Hospitals”的对象转换为类型为“ System.Collections.Generic.IEnumerable”的对象

  3. 3

    MVC:字典需要类型为'System.Collections.Generic.IEnumerable`1的模型项

  4. 4

    MVC:字典需要类型为'System.Collections.Generic.IEnumerable`1的模型项

  5. 5

    无法将类型为“ System.Data.Entity.DbSet” [City]的对象转换为类型为“ System.Collections.Generic.IEnumerable`1 [System.Web.Mvc.SelectListItem]”的对象

  6. 6

    无法将类型'System.Collections.Generic.IEnumerable <AnonymousType#1>'隐式转换为'System.Collections.Generic.IEnumerable <T>

  7. 7

    如何声明类型为System.Collections.Generic.IEnumerable的变量?

  8. 8

    无法隐式转换类型'System.Collections.Generic.IEnumerable

  9. 9

    无法隐式转换类型'System.Collections.Generic.IEnumerable <System.Collections.Generic.ICollection

  10. 10

    无法将类型为“ System.Collections.ArrayList”的对象转换为类型为“ System.Collections.Generic.IEnumerable”

  11. 11

    无法将类型'System.Linq.IQueryable <AnonymousType#1>'隐式转换为'System.Collections.Generic.IEnumerable <SubCateViewModel>'

  12. 12

    无法将类型System.Collections.Generic.Ienumerable <string>隐式转换为system.Linq.IOrderedEnumerable <AnonymousType#1>

  13. 13

    无法将类型'System.Collections.Generic.IEnumerable隐式转换为System.Collections.Generic.IEnumerable <TiendaDeportes.producto>

  14. 14

    无法将类型'Task <System.Collections.Generic.IEnumerable <IClass >>隐式转换为'System.Collections.Generic.IEnumerable <IClass>

  15. 15

    'System.Collections.Generic.List`1[<>f__AnonymousType1 但这个字典需要一个'System.Collections.Generic.IEnumerable ERROR 类型的模型项

  16. 16

    C#JSON错误=>无法将JSON对象反序列化为类型'System.Collections.Generic.IEnumerable`1

  17. 17

    无法从System.Collections.Generic.List转换为System.Collections.Generic.IEnumerable

  18. 18

    无法从'System.Collections.Generic.IEnumerable <char>'转换为'string'

  19. 19

    无法从'string'转换为'System.Collections.Generic.IEnumerable <string>

  20. 20

    无法将类型System.Collections.Generic.List <IEnumerable>隐式转换为<IEnumerable

  21. 21

    错误“无法将类型“System.Collections.Generic.IEnumerable<int>”隐式转换为“System.Collections.Generic.List<int>”

  22. 22

    无法将类型System.Linq.IQueryable隐式转换为System Collections.Generic.IEnumerable

  23. 23

    字典需要一个“System.Collections.Generic.IEnumerable`1[ShimbaSchool.Models.EventMessageDepartment]”类型的模型项

  24. 24

    system.collections.generic.IEnumerable 错误

  25. 25

    无法将类型'System.Collections.Generic.IEnumerable <string>隐式转换为字符串

  26. 26

    ASP.NET LINQ错误无法创建类型为'System.Collections.Generic.List`1 [System.Int32]'的查询结果

  27. 27

    Dapper:找不到方法:'System.Collections.Generic.IEnumerable`1 <!! 0> GridReader.Read(Boolean)'

  28. 28

    SignalR:无法从System.String强制转换或转换为System.Collections.Generic.IEnumerable

  29. 29

    无法将类型'System.Collections.Generic.List <String>'隐式转换为'System.Collections.Generic.IEnumerable <turon.Model.Products_Products>

热门标签

归档