实体框架 - WCF - 返回JSON怎么做? [英] Entity framework - WCF - return JSON how to do this?
问题描述
我的问题是关于我需要添加到此设置中的元素,以便从我的Web服务返回干净的JSON。
我是一个初学者欢迎所有观点。谢谢!
您可以定义具有干净格式的XXXDto类,以满足客户需求。然后将域/终端类映射到Dto对象并使用WCF进行序列化。
或者您可以创建WCF OData服务将服务公开为OData源。
I have all the POCO entities produced from my database. I created an IXXX interface, a XXX class to define the structure of the table I want to return from my service, and a XXX class to do the query and the return part for the interface.
My question is regarding the elements I need to add to this setup in order to return clean JSON from my web service.
I'm a beginner so all points of view are welcome. Thanks!
You can define XXXDto classes which are having a clean format for your client needs. And then map the domain/endity classes to Dto objects and serialize them using WCF.
Or you can create WCF OData services to expose the service as OData source.
这篇关于实体框架 - WCF - 返回JSON怎么做?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!