Only parameterless constructors and initializers are supported in LINQ to Entities

后端 未结 14 1366
暗喜
暗喜 2020-11-27 15:27

I have this error in this linq expression :

var naleznosci = (from nalTmp in db.Naleznosci
                              where nalTmp.idDziecko == idDziec
           


        
14条回答
  •  温柔的废话
    2020-11-27 16:06

    Just ToList() the DbSet before the Select statement.. the actual DbSet is saved as a query, it's not fulfilled yet. After calling ToList() you're playing with objects, and then you can use a non-default constructor in the query.

    Not the most efficient way usage-time wise, but it's an option on small sets.

提交回复
热议问题