服务引用复杂类型 [英] Service reference complex types

查看:108
本文介绍了服务引用复杂类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个客户端应用程序消耗所接受并返回一些复杂的类型参数的WCF服务。这些复杂类型是在一个单独的程序召开,无论是客户端应用程序和WCF服务所引用..
中的问题是,当我加在客户端应用程序的服务引用,所生成的参考类构建自己的版本复杂的参数类型,因此我不能传递从原始类型定义的组件的类型。
不知道这是在所有可以理解的。

I have a client app consuming a WCF service that is accepting and returning some complex type parameters. these complex types are held in a separate assembly that both the client app and the WCF service are referencing.. the problem is that when I add the service reference in the client app, the generated reference class builds its own versions of the complex parameter types and hence I cant pass in the types from the assembly that the original types are defined. not sure if that is at all understandable..

问题是..我是不得不写某种反射深拷贝过程中有效地建立了服务引用生成的原始类型中的类?
或者是有一个更好的选择。

question is.. am I going to have to write some sort of reflective deep copy routine to effectively build up the service reference generated classes from the original types? or is there a better option

如初非常高兴地接受

NAT

推荐答案

当您添加服务引用代码,选择高级,你会看到一个选项重用类型引用的程序集。如果确保被选中,并且参考被加入到该项目,WCF不会生成代理的类型和使用的被引用类型,而不是

When you are adding a service reference to code, select Advanced and you'll see an option Reuse types in referenced assemblies. If you ensure that is checked, and the reference is added to the project, WCF won't generate the proxy types and use the referenced types instead.

如果您已已经添加了服务引用,首先引用您的共享类型,然后用鼠标右键单击该服务引用,然后选择配置服务参考来得到它使用引用重新生成客户端代码类型。

If you've already added the service reference, reference your shared types first, and then right-click the Service Reference, and select Configure Service Reference to get it to regenerate the client code using your referenced types.

这篇关于服务引用复杂类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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