实体或复杂类型不能在linq到实体查询中构造 [英] the entity or complex type cannot be constructed in a linq to entities query

查看:74
本文介绍了实体或复杂类型不能在linq到实体查询中构造的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



任何人都可以帮我解决这个问题。

实体或复杂类型无法在linq中构建实体查询。



无法在LINQ to Entities查询中构造实体或复杂类型'testModel.member'。



非常感谢...

Hi All,

can anybody help me to resolve this.
the entity or complex type cannot be constructed in a linq to entities query.

The entity or complex type 'testModel.member' cannot be constructed in a LINQ to Entities query.

Thanks a lot...

推荐答案

像这样的实体使用AsEnumerable!



use AsEnumerable with the entity like this!

public IEnumerable<dml.person> GetAll()
        {
       
            var a = (from p in dbo.Person.AsEnumerable()
                     join r in dbo.Role.AsEnumerable() on p.PersonRoleID equals r.RoleID
                     select new DML.Person { 
                      Name =  p.Name,
                       Role= r.Name

                     });

           return a;

        }
</dml.person>


如果你搜索谷歌有很多例子这个问题被问到了。



这里甚至有一个:错误实体或复杂类型'EPatient.Models.cls_Measurement'不能在LINQ to Entities查询中构造。 [ ^ ]



也许你有同样的问题,解决方案同样适用于你。



鉴于有限我们可以看到的信息,无法访问您的解决方案,这是我能建议的最佳信息。
If you search google there is a whole host of examples of this question being asked.

There is even one on here: Error "The entity or complex type 'EPatient.Models.cls_Measurement' cannot be constructed in a LINQ to Entities query."[^]

Maybe you have the same problem and the solution equally applies to you.

Given the limited information we can see, and having no access to your solution, that is the best I can suggest.


这篇关于实体或复杂类型不能在linq到实体查询中构造的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆