A lambda expression with a statement body cannot be converted to an expression tree in nopCommerce [duplicate]

匆匆过客 提交于 2019-12-01 15:27:16
jason

The error message is exactly what it says. You have a lambda expression. It has a statement body. A lambda expression with a statement body can not be converted to an expression tree. But Join requires an expression tree to use with EF. You should try replacing what you have with a lambda expression that doesn't have a body like:

(cev, c) => new CustomerEventRolesModel {
                Id = cev.Id,
                CustomerId = c.Id
            }

And so on.

By the way,

ContactName = c.GetAttribute<string>(SystemCustomerAttributeNames.FirstName)

will NOT work with EF. Period. You better figure something else out.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!