LINQ to Entities does not recognize the method 'Int32 Parse(System.String)' method when attempting to parse a column for inequality comparisons

后端 未结 7 1126
抹茶落季
抹茶落季 2020-12-09 15:55

I have following code in my page:

var myVar= Entity.SetName
                 .Where(p => int.Parse(p.ID) >= start &&
                  int.Pars         


        
7条回答
  •  情书的邮戳
    2020-12-09 16:15

    You cannot convert in query at the end of the query you can parse it with select.

    If you want to keep an integer list, you can use it.

    var locquery = entityDataContainer.application
                    .Where(x => x.AttributeType == "LOC").AsQueryable()                                                        
                    .Select(x => x.AttributeValue).ToList();
    
    var locCount = locquery.Select(int.Parse).ToList().Sum();
    

提交回复
热议问题