询问者
ado.net实体数据模型实体类是不是不能序列化后传递

问题
全部回复
-
我直接在rest wcf中直接传递实体报错,是不是不能序列化为Json?
可以,但是要定义为数据契约。
WCF支持Json。
你WCF服务代码怎么写的?
Frank Xu Lei--谦卑若愚,好学若饥
专注于.NET平台下分布式应用系统开发和企业应用系统集成
Focus on Distributed Applications Development and EAI based on .NET
【老徐的网站】:http://www.frankxulei.com/
- 已建议为答案 Frank Xu LeiModerator 2011年3月4日 12:27
-
我是调用存储过程GetUser,本来想返回一个结果的
[WebGet(ResponseFormat=WebMessageFormat.Json)]
public GetUser_Result Validate(string username, string pwd)
{
// 在此处添加操作实现
var db = new worldlinkEntities();
var result = db.GetUser(username, pwd);return users.First<GetUser_Result>();
}
这个代码是正确的,你得到什么样的Exception?
Mog Liang
Please mark the replies as answers if they help or unmark if not.
If you have any feedback about my replies, please contact msdnmg@microsoft.com.
Microsoft One Code Framework -
你查看一下GetUser_Result的代码。我这里测试的是,EentityFramework会为Entity或ComplexType设定序列化的Attribute,应该可以正常序列化。
我用的是.net 4
Mog Liang
Please mark the replies as answers if they help or unmark if not.
If you have any feedback about my replies, please contact msdnmg@microsoft.com.
Microsoft One Code Framework