使用LINQ to Entities的WCF [英] WCF using LINQ to Entities

查看:66
本文介绍了使用LINQ to Entities的WCF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我们在WCF服务中使用Linq to Entities。我们创建了一个包含自动生成实体的edmx文件。在创建代理时,即使数据协定和datamember属性存在,实体也不会出现在代理类中。我们发现问题是因为自动生成的实体继承自System.Data.Objects.DataClasses.EntityObject。但是如果我们创建一个没有任何继承的类,那么该类出现在代理中。有什么方法可以解决这个问题吗?

问候
赛车

Hi,

We are using Linq to Entities in WCF service. We created a edmx file which contains auto generated entities. While creating proxy the entities are not appearing in the proxy class even the data contract and datamember attributes are there. We found that the problem is because of the auto generated entities are inheriting from something called System.Data.Objects.DataClasses.EntityObject. But if we create a class without any inheritance that class is appearing in the proxy. Is there any way to resolve this?

Regards
Syed

推荐答案

EF创建的所有实体类型都标有DataContractAttribute允许它们从WCF序列化,因此代理不应该为这些类生成代码。

你确定你已经声明了返回你声明的类型的服务操作吗?

你可以在这里粘贴服务合同吗?
All the entity types EF creates are marked with DataContractAttribute to allow them to be serialized from WCF, so there's no reason why a proxy should not generate code for these classes.

Are you sure you've declared service operations that return the types you declared?

Can you paste here the service contract?


这篇关于使用LINQ to Entities的WCF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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