WCF重用类型 [英] WCF Reuse Types

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

问题描述

什么是中引用的程序集重用类型actualy办?

What does "Reuse Types in Referenced Assemblies" actualy do?

感谢

推荐答案

基本上,它是用来共享的服务端和客户端之间的数据契约的定义。 当你在你的数据计算出的合同属性或辅助方法,这是非常有用的。

Basically, it is used to share the definition of your data contracts between service and client. It is very useful when you have calculated properties or helper methods in your data contracts.

这也是一种方式,以避免重新生成服务引用时,只有数据契约变更。

It is also a way to avoid regenerating the service reference when only the data contracts changes.

假设你有使用相同的A级两个服务,并公开方法与参数,或者如果您使用常规服务引用在客户端应用程序,连接到这两个服务,您将有两个A类客户端返回一个类型A的值应用程序,他们甚至不兼容。

Suppose you have two services using the same class A and expose methods with parameters or return values of type A. If you use regular service references in a client app that connects to both services, you will have two A classes in your client app and they are not even compatible.

如果你把一个成一个单独的程序和客户端和服务之间共享(并定义在服务引用重用类型...),那么你就可以完全重复使用相同的类无处不在,避免重复一些类。

If you put A into a separate assembly and share it between client and services (and define the "Reuse types..." in your service references), then you can reuse exactly the same class everywhere and avoid duplicating some classes.

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

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