WCF datacontract问题,无法查看所有datacontract [英] WCF datacontract problem, unable to see all datacontract

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

问题描述

我正在开发一个wcf项目。在服务方面,我定义了像这样的datacontract



I am working on a wcf project. at service side I defined datacontract like that

[ServiceContract]
 public interface IDictionaryService
 {
     [OperationContract]
     TranslationData TranslateWord(TranslationData tData);
 }
 [DataContract]
 public class TranslationData
 {
     ........
 }





我在客户端成功使用了TranslationData实例。然后我再添加两个datacontract,问题是我看不到两个新添加的datacontract,无法在客户端定义他们的实例。我更新了服务并做了所有事情,但它不起作用。

有没有人告诉我为什么会发生这种情况?



整个代码如下所示





I successfully used the TranslationData instance on client side. then I add two more datacontract , problem is I can't see the two new added datacontract and unable to define their instance on client side. I updated the service and did everything but it dose not work.
is there any one who tell me why that happend?

whole code is shown as below

[ServiceContract]
 public interface IDictionaryService
 {
     [OperationContract]
     TranslationData TranslateWord(TranslationData tData);
 }
 [DataContract]
 public class TranslationData
 {
     ...........................
 }

 [DataContract]
 public class SerachItem
 {
     .................................
 }

 [DataContract]
 public class TargetItem
 {
     .....................................
 }





总之我无法在客户端使用所有datacontract,为什么?



in short I am unable to use all datacontract on client side, why?

推荐答案

我发现发生了什么。

它没有显示的原因是我定义了datacontract,但没有在界面中使用它。在我使用datacontract后,我在客户端看到它。



顺便说一下,谢谢大家!
I find out what is going on.
the reason it did not show up is I defined datacontract , but did not use it in interface. after I use the datacontract I see it on client side.

by the way, thank you everyone !


是的,Alimjan Yasin。你是对的,在创建数据合同类之后我们必须在界面中使用它。但我不明白为什么?希望有人可以提供帮助吗?
Yes, Alimjan Yasin. You are right, after creating data contract class we have to use it in interface. But I don't get it why ? Hope somebody can help ?


删除并更新服务参考


这篇关于WCF datacontract问题,无法查看所有datacontract的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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