LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression

后端 未结 11 2010
花落未央
花落未央 2020-11-22 10:41

I\'m migrating some stuff from one mysql server to a sql server but i can\'t figure out how to make this code work:

using (var context = new Context())
{
            


        
11条回答
  •  有刺的猬
    2020-11-22 11:06

    Had a similar problem. Solved it by calling ToList() on the entity collection and querying the list. If the collection is small this is an option.

    IQueryable pages = context.pages.ToList().Where(p=>p.serial == item.Key.ToString())
    

    Hope this helps.

提交回复
热议问题