是“由参”在WCF坏的或好的理由? [英] Are 'by ref' arguments in WCF bad or good?

查看:174
本文介绍了是“由参”在WCF坏的或好的理由?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近看到一个WCF服务与声明的由参的参数运行的合同。

I've recently seen a WCF service declaring operation contracts with by ref arguments.

我不知道为什么要这样设计决定是(操作无效),但此外,我不能 - 从我的WCF知识 - 说,如果这是一个很好的做法与否。或者,如果这是不相关的。

I don't know why this design decision was taken (operations are void), but furthermore, I'm not able - from my WCF knowledge - to say if this is a good practice or not. Or if this is not relevant.

你怎么想的?

推荐答案

然而,根据这个微软第一个WCF呼叫的行为完全像一个远程过程调用和为ByRef参数可用于返回数据: -

However, According to this Microsoft Article a WCF Call behaves exactly like a Remote Procedure Call and ByRef arguments can be used to return data:-

http://msdn.microsoft.com/en-us/library/ ms733070.aspx

具体请参考:out和ref参数

Refer to the section: Out and Ref Parameters

在大多数情况下,你可以(在Visual Basic BYVAL)的参数和使用
  out和ref参数(为ByRef在Visual Basic中)。因为这两个出来,
  ref参数表明数据是从一个操作返回,一个
  操作签名,如下面指定了一个
  请求/应答操作是必需的,即使操作
  签名返回void。

In most cases, you can use in parameters (ByVal in Visual Basic) and out and ref parameters (ByRef in Visual Basic). Because both out and ref parameters indicate that data is returned from an operation, an operation signature such as the following specifies that a request/reply operation is required even though the operation signature returns void.

这篇关于是“由参”在WCF坏的或好的理由?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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