MessageContractMemberAttribute.Namespace 属性

定义

指定与此成员对应的元素的命名空间。

public:
 property System::String ^ Namespace { System::String ^ get(); void set(System::String ^ value); };
public string Namespace { get; set; }
member this.Namespace : string with get, set
Public Property Namespace As String

属性值

与此成员对应的元素的命名空间 URI。

示例

下面的代码示例演示了一个自定义消息协定,该MessageBodyMemberAttribute协定使用MessageHeaderAttributeMessageContractAttribute和属性(全部继承自MessageContractMemberAttribute)创建自定义类型化消息以在操作中使用。 在这种情况下,有三个成员序列化为 SOAP 消息的正文元素: sourceAccounttargetAccount以及 amount 值(它序列化为具有名称 transactionAmount的元素)。 此外, IsAudited SOAP 标头元素驻留在命名空间中 http://schemas.contosobank.com/auditing/2005 ,并 sourceAccount 经过加密和数字签名。

注释

OperationAccount类型必须具有数据协定。

[MessageContract]
public class BankingTransaction
{
  [MessageHeader] public Operation operation;
  [MessageHeader(Namespace="http://schemas.contosobank.com/auditing/2005")] public bool IsAudited;
  [MessageBody] public Account sourceAccount;
  [MessageBody] public Account targetAccount;
  [MessageBody(Name="transactionAmount")] public int amount;

适用于