转换实体框架模型数据的合约 [英] Converting entity framework model to data contract

查看:104
本文介绍了转换实体框架模型数据的合约的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个WCF Web服务,使用户对数据库的访问。对于数据库模型我使用实体框架。问题是,我有实体框架内这么多的类,它会花费太多时间手工编写一个datacontract。有没有一种简单的方法来避免这种情况?

I have created a wcf web service that enable user access to database. For database model I use entity framework. Problem is that I have so much classes inside of entity framework and it will take too much time to write a datacontract by hand. Is there a easy way to avoid that?

推荐答案

不敢相信它。实体框架类不需要是功能标签为[DataContract]。消费与WCF测试客户端服务时,但我的WPF客户端是伟大的工作我得到了错误。我对此感到非常抱歉。

Cant believe it. Entity framework classes dont need to be taged as [DataContract]. I got error when consuming service with wcf test client, but my wpf client is working great. I am so sorry about that.

这篇关于转换实体框架模型数据的合约的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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