2826a415c982fb96af65920d40c66c20184a98d8
[mono.git] / mcs / class / System.Web.Services / System.Web.Services / WebMethodAttribute.cs
1  // \r
2 // System.Web.Services.WebMethodAttribute.cs\r
3 //\r
4 // Author:\r
5 //   Tim Coleman (tim@timcoleman.com)\r
6 //\r
7 // Copyright (C) Tim Coleman, 2002\r
8 //\r
9
10 //
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:
18 // 
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 // 
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.
29 //
30 \r
31 using System.EnterpriseServices;\r
32 \r
33 namespace System.Web.Services {\r
34         [AttributeUsage(AttributeTargets.Method, Inherited = true)]\r
35         public sealed class WebMethodAttribute : Attribute {\r
36 \r
37                 #region Fields\r
38 \r
39                 bool bufferResponse;\r
40                 int cacheDuration;\r
41                 string description;\r
42                 bool enableSession;\r
43                 string messageName;\r
44                 TransactionOption transactionOption;\r
45 \r
46                 #endregion // Fields\r
47 \r
48                 #region Constructors\r
49 \r
50                 public WebMethodAttribute ()\r
51                         : this (false, TransactionOption.Disabled, 0, true)\r
52                 {\r
53                 }\r
54 \r
55                 public WebMethodAttribute (bool enableSession)\r
56                         : this (enableSession, TransactionOption.Disabled, 0, true)\r
57                 {\r
58                 }\r
59 \r
60                 public WebMethodAttribute (bool enableSession, TransactionOption transactionOption)\r
61                         : this (enableSession, transactionOption, 0, true)\r
62                 {\r
63                 }\r
64 \r
65                 public WebMethodAttribute (bool enableSession, TransactionOption transactionOption, int cacheDuration)\r
66                         : this (enableSession, transactionOption, cacheDuration, true)\r
67                 {\r
68                 }\r
69 \r
70                 public WebMethodAttribute (bool enableSession, TransactionOption transactionOption, int cacheDuration, bool bufferResponse)\r
71                 {\r
72                         this.bufferResponse = bufferResponse;\r
73                         this.cacheDuration = cacheDuration;\r
74                         this.enableSession = enableSession;\r
75                         this.transactionOption = transactionOption;\r
76 \r
77                         this.description = String.Empty;\r
78                         this.messageName = String.Empty;\r
79                 }\r
80                 \r
81                 #endregion // Constructors\r
82 \r
83                 #region Properties\r
84 \r
85                 public bool BufferResponse {\r
86                         get { return bufferResponse; }\r
87                         set { bufferResponse = value; }\r
88                 }\r
89 \r
90                 public int CacheDuration {\r
91                         get { return cacheDuration; }\r
92                         set { cacheDuration = value; }\r
93                 }\r
94 \r
95                 public string Description { \r
96                         get { return description; }\r
97                         set { description = value; }\r
98                 }\r
99 \r
100                 public bool EnableSession {\r
101                         get { return enableSession; }\r
102                         set { enableSession = value; }\r
103                 }\r
104 \r
105                 public string MessageName {\r
106                         get { return messageName; }\r
107                         set { messageName = value; }\r
108                 }\r
109 \r
110                 public TransactionOption TransactionOption {\r
111                         get { return transactionOption; }\r
112                         set { transactionOption = value; }\r
113                 }\r
114 \r
115                 #endregion // Properties\r
116         }\r
117 }\r