[System*] Throw a PlatformNotSupported exception when using the managed networking...
[mono.git] / mcs / class / System.Data / System.Data.SqlClient / SqlCommand.platformnotsupported.cs
1 //
2 // SqlCommand.cs
3 //
4 // Author:
5 //       Rolf Bjarne Kvinge <rolf@xamarin.com>
6 //
7 // Copyright (c) 2016 Xamarin, Inc.
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining a copy
10 // of this software and associated documentation files (the "Software"), to deal
11 // in the Software without restriction, including without limitation the rights
12 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 // copies of the Software, and to permit persons to whom the Software is
14 // furnished to do so, subject to the following conditions:
15 //
16 // The above copyright notice and this permission notice shall be included in
17 // all copies or substantial portions of the Software.
18 //
19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 // THE SOFTWARE.
26
27 using System.Data.Common;
28 using System.Data.Sql;
29 using System.Threading.Tasks;
30 using System.Threading;
31 using System.Xml;
32
33 namespace System.Data.SqlClient {
34         public sealed class SqlCommand : DbCommand, IDbCommand, ICloneable
35         {
36                 const string EXCEPTION_MESSAGE = "System.Data.SqlClient.SqlCommand is not supported on the current platform.";
37
38                 public SqlCommand()
39                         : this (String.Empty, null, null)
40                 {
41                 }
42
43                 public SqlCommand (string cmdText)
44                         : this (cmdText, null, null)
45                 {
46                 }
47
48                 public SqlCommand (string cmdText, SqlConnection connection)
49                         : this (cmdText, connection, null)
50                 {
51                 }
52
53                 public SqlCommand (string cmdText, SqlConnection connection, SqlTransaction transaction)
54                 {
55                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
56                 }
57
58                 public override string CommandText {
59                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
60                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
61                 }
62
63                 public override int CommandTimeout {
64                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
65                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
66                 }
67
68                 public override CommandType CommandType {
69                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
70                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
71                 }
72
73                 public new SqlConnection Connection {
74                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
75                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
76                 }
77
78                 public override bool DesignTimeVisible {
79                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
80                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
81                 }
82
83                 public new SqlParameterCollection Parameters {
84                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
85                 }
86
87                 public new SqlTransaction Transaction {
88                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
89                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
90                 }
91
92                 public override UpdateRowSource UpdatedRowSource {
93                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
94                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
95                 }
96
97                 public SqlNotificationRequest Notification {
98                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
99                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
100                 }
101
102                 public bool NotificationAutoEnlist {
103                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
104                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
105                 }
106
107                 public override void Cancel ()
108                 {
109                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
110                 }
111
112                 public SqlCommand Clone ()
113                 {
114                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
115                 }
116
117                 public new SqlParameter CreateParameter ()
118                 {
119                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
120                 }
121
122                 public override int ExecuteNonQuery ()
123                 {
124                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
125                 }
126
127                 public new SqlDataReader ExecuteReader ()
128                 {
129                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
130                 }
131
132                 public new SqlDataReader ExecuteReader (CommandBehavior behavior)
133                 {
134                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
135                 }
136
137                 public new Task<SqlDataReader> ExecuteReaderAsync ()
138                 {
139                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
140                 }
141
142                 public new Task<SqlDataReader> ExecuteReaderAsync (CancellationToken cancellationToken)
143                 {
144                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
145                 }
146
147                 public new Task<SqlDataReader> ExecuteReaderAsync (CommandBehavior behavior)
148                 {
149                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
150                 }
151
152                 public new Task<SqlDataReader> ExecuteReaderAsync (CommandBehavior behavior, CancellationToken cancellationToken)
153                 {
154                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
155                 }
156
157                 public Task<XmlReader> ExecuteXmlReaderAsync ()
158                 {
159                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
160                 }
161
162                 public Task<XmlReader> ExecuteXmlReaderAsync (CancellationToken cancellationToken)
163                 {
164                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
165                 }
166
167                 public override object ExecuteScalar ()
168                 {
169                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
170                 }
171
172                 public XmlReader ExecuteXmlReader ()
173                 {
174                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
175                 }
176
177                 object ICloneable.Clone ()
178                 {
179                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
180                 }
181
182                 protected override void Dispose (bool disposing)
183                 {
184                 }
185
186                 public override void Prepare ()
187                 {
188                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
189                 }
190
191                 public void ResetCommandTimeout ()
192                 {
193                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
194                 }
195
196                 protected override DbParameter CreateDbParameter ()
197                 {
198                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
199                 }
200
201                 protected override DbDataReader ExecuteDbDataReader (CommandBehavior behavior)
202                 {
203                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
204                 }
205
206                 protected override DbConnection DbConnection {
207                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
208                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
209                 }
210
211                 protected override DbParameterCollection DbParameterCollection {
212                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
213                 }
214
215                 protected override DbTransaction DbTransaction {
216                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
217                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
218                 }
219
220                 public IAsyncResult BeginExecuteNonQuery ()
221                 {
222                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
223                 }
224
225                 public IAsyncResult BeginExecuteNonQuery (AsyncCallback callback, object stateObject)
226                 {
227                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
228                 }
229
230                 public int EndExecuteNonQuery (IAsyncResult asyncResult)
231                 {
232                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
233                 }
234
235                 public IAsyncResult BeginExecuteReader ()
236                 {
237                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
238                 }
239
240                 public IAsyncResult BeginExecuteReader (CommandBehavior behavior)
241                 {
242                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
243                 }
244
245                 public IAsyncResult BeginExecuteReader (AsyncCallback callback, object stateObject)
246                 {
247                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
248                 }
249
250                 public IAsyncResult BeginExecuteReader (AsyncCallback callback, object stateObject, CommandBehavior behavior)
251                 {
252                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
253                 }
254
255                 public SqlDataReader EndExecuteReader (IAsyncResult asyncResult)
256                 {
257                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
258                 }
259
260                 public IAsyncResult BeginExecuteXmlReader (AsyncCallback callback, object stateObject)
261                 {
262                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
263                 }
264
265                 public IAsyncResult BeginExecuteXmlReader ()
266                 {
267                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
268                 }
269
270                 public XmlReader EndExecuteXmlReader (IAsyncResult asyncResult)
271                 {
272                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
273                 }
274
275                 public event StatementCompletedEventHandler StatementCompleted;
276         }
277 }