2 // System.Web.Services.WebMethodAttribute.cs
5 // Tim Coleman (tim@timcoleman.com)
7 // Copyright (C) Tim Coleman, 2002
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 #if !TARGET_J2EE && !MONOTOUCH
32 using System.EnterpriseServices;
35 namespace System.Web.Services {
37 #if TARGET_J2EE || MONOTOUCH
38 public enum TransactionOption {Disabled , NotSupported , Required , RequiresNew , Supported }
41 [AttributeUsage(AttributeTargets.Method, Inherited = true)]
42 public sealed class WebMethodAttribute : Attribute {
51 TransactionOption transactionOption;
57 public WebMethodAttribute ()
58 : this (false, TransactionOption.Disabled, 0, true)
62 public WebMethodAttribute (bool enableSession)
63 : this (enableSession, TransactionOption.Disabled, 0, true)
67 public WebMethodAttribute (bool enableSession, TransactionOption transactionOption)
68 : this (enableSession, transactionOption, 0, true)
72 public WebMethodAttribute (bool enableSession, TransactionOption transactionOption, int cacheDuration)
73 : this (enableSession, transactionOption, cacheDuration, true)
77 public WebMethodAttribute (bool enableSession, TransactionOption transactionOption, int cacheDuration, bool bufferResponse)
79 this.bufferResponse = bufferResponse;
80 this.cacheDuration = cacheDuration;
81 this.enableSession = enableSession;
82 this.transactionOption = transactionOption;
84 this.description = String.Empty;
85 this.messageName = String.Empty;
88 #endregion // Constructors
92 public bool BufferResponse {
93 get { return bufferResponse; }
94 set { bufferResponse = value; }
97 public int CacheDuration {
98 get { return cacheDuration; }
99 set { cacheDuration = value; }
102 public string Description {
103 get { return description; }
104 set { description = value; }
107 public bool EnableSession {
108 get { return enableSession; }
109 set { enableSession = value; }
112 public string MessageName {
113 get { return messageName; }
114 set { messageName = value; }
117 public TransactionOption TransactionOption {
118 get { return transactionOption; }
119 set { transactionOption = value; }
122 #endregion // Properties