Only parameterless constructors and initializers are supported in LINQ to Entities

后端 未结 14 1405
暗喜
暗喜 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 15:53

    Having just encountered this error myself, I thought I would add that if the Payment type is a struct, you would also encounter the same error because struct types do not support parameterless constructors.

    In that event, converting Payment to a class and using the object initializer syntax will resolve the issue.

提交回复
热议问题