2 // System.ServiceModel.MessageVersion.cs
4 // Author: Duncan Mak (duncan@novell.com)
6 // Copyright (C) 2005 Novell, Inc (http://www.novell.com)
8 // Permission is hereby granted, free of charge, to any person obtaining
9 // a copy of this software and associated documentation files (the
10 // "Software"), to deal in the Software without restriction, including
11 // without limitation the rights to use, copy, modify, merge, publish,
12 // distribute, sublicense, and/or sell copies of the Software, and to
13 // permit persons to whom the Software is furnished to do so, subject to
14 // the following conditions:
16 // The above copyright notice and this permission notice shall be
17 // included in all copies or substantial portions of the Software.
19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 using System
.ServiceModel
;
31 namespace System
.ServiceModel
.Channels
{
33 public sealed class MessageVersion
35 EnvelopeVersion envelope
;
36 AddressingVersion addressing
;
38 MessageVersion (EnvelopeVersion envelope
, AddressingVersion addressing
)
40 this.envelope
= envelope
;
41 this.addressing
= addressing
;
44 public static MessageVersion
CreateVersion (EnvelopeVersion envelope_version
)
46 return CreateVersion (envelope_version
,
47 AddressingVersion
.WSAddressing10
);
50 public static MessageVersion
CreateVersion (EnvelopeVersion envelope_version
,
51 AddressingVersion addressing_version
)
53 return new MessageVersion (envelope_version
, addressing_version
);
56 public override bool Equals (object value)
58 MessageVersion other
= value as MessageVersion
;
63 return (other
.Addressing
== this.Addressing
) && (other
.Envelope
== this.Envelope
);
66 public override int GetHashCode ()
68 return addressing
.GetHashCode () + envelope
.GetHashCode ();
71 public override string ToString ()
73 return envelope
.ToString () + " " + addressing
.ToString ();
76 public AddressingVersion Addressing
{
77 get { return addressing; }
80 public static MessageVersion Default
{
81 get { return CreateVersion (EnvelopeVersion.Soap12); }
84 public EnvelopeVersion Envelope
{
85 get { return envelope; }
88 public static MessageVersion None
{
89 get { return CreateVersion (EnvelopeVersion.None, AddressingVersion.None); }
92 public static MessageVersion Soap11
{
93 get { return CreateVersion (EnvelopeVersion.Soap11, AddressingVersion.None); }
96 public static MessageVersion Soap12
{
97 get { return CreateVersion (EnvelopeVersion.Soap12, AddressingVersion.None); }
100 public static MessageVersion Soap11WSAddressing10
{
101 get { return CreateVersion (EnvelopeVersion.Soap11, AddressingVersion.WSAddressing10); }
104 public static MessageVersion Soap11WSAddressingAugust2004
{
105 get { return CreateVersion (EnvelopeVersion.Soap11, AddressingVersion.WSAddressingAugust2004); }
108 public static MessageVersion Soap12WSAddressing10
{
109 get { return CreateVersion (EnvelopeVersion.Soap12, AddressingVersion.WSAddressing10); }
112 public static MessageVersion Soap12WSAddressingAugust2004
{
113 get { return CreateVersion (EnvelopeVersion.Soap12, AddressingVersion.WSAddressingAugust2004); }