1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
5 using System
.Collections
;
6 using System
.Data
.Common
;
7 using System
.Data
.ProviderBase
;
8 using System
.Diagnostics
;
9 using System
.Threading
;
10 using System
.Threading
.Tasks
;
11 using System
.Diagnostics
.CodeAnalysis
;
12 using System
.Transactions
;
13 using Microsoft
.SqlServer
.Server
;
14 using System
.Reflection
;
16 using System
.Globalization
;
17 using System
.Security
;
19 namespace System
.Data
.SqlClient
21 public sealed partial class SqlConnection
: DbConnection
, ICloneable
23 const string EXCEPTION_MESSAGE
= "System.Data.SqlClient.SqlConnection is not supported on the current platform.";
25 internal SqlStatistics _statistics
;
26 internal Task _currentReconnectionTask
;
27 internal SessionData _recoverySessionData
;
28 internal bool _suppressStateChangeForReconnection
;
29 internal bool _applyTransientFaultHandling
= false;
31 public SqlConnection() : base() => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
32 public SqlConnection(string connectionString
) : this() {}
34 public bool StatisticsEnabled
{
35 get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
36 set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
39 internal bool AsyncCommandInProgress
{
40 get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
41 set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
44 internal SqlConnectionString
.TransactionBindingEnum TransactionBinding
45 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
47 internal SqlConnectionString
.TypeSystem TypeSystem
48 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
50 internal Version TypeSystemAssemblyVersion
51 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
53 internal int ConnectRetryInterval
54 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
56 public override string ConnectionString
{
57 get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
58 set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
61 public override int ConnectionTimeout
62 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
64 public override string Database
65 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
67 public override string DataSource
68 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
71 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
73 public Guid ClientConnectionId
74 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
76 public override string ServerVersion
77 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
79 public override ConnectionState State
80 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
82 internal SqlStatistics Statistics
83 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
85 public string WorkstationId
86 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
88 protected override DbProviderFactory DbProviderFactory
89 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
91 public event SqlInfoMessageEventHandler InfoMessage
;
93 public bool FireInfoMessageEventOnUserErrors
{
94 get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
95 set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
98 internal int ReconnectCount
99 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
101 internal bool ForceNewConnection
{
102 get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
103 set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
106 protected override void OnStateChange(StateChangeEventArgs stateChange
)
107 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
109 new public SqlTransaction
BeginTransaction()
110 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
112 new public SqlTransaction
BeginTransaction(IsolationLevel iso
)
113 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
115 public SqlTransaction
BeginTransaction(string transactionName
)
116 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
118 override protected DbTransaction
BeginDbTransaction(IsolationLevel isolationLevel
)
119 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
121 public SqlTransaction
BeginTransaction(IsolationLevel iso
, string transactionName
)
122 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
124 public override void ChangeDatabase(string database
)
125 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
127 public static void ChangePassword(string connectionString
, string newPassword
)
128 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
130 public static void ChangePassword(string connectionString
, SqlCredential credential
, SecureString newSecurePassword
)
131 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
133 public static void ClearAllPools()
134 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
136 public static void ClearPool(SqlConnection connection
)
137 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
139 public override void Close()
140 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
142 new public SqlCommand
CreateCommand()
143 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
145 public override void Open()
146 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
148 internal void RegisterWaitingForReconnect(Task waitingTask
)
149 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
151 internal Task
ValidateAndReconnect(Action beforeDisconnect
, int timeout
)
152 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
154 public override Task
OpenAsync(CancellationToken cancellationToken
)
155 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
157 public override DataTable
GetSchema()
158 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
160 public override DataTable
GetSchema(string collectionName
)
161 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
163 public override DataTable
GetSchema(string collectionName
, string[] restrictionValues
)
164 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
166 internal bool HasLocalTransaction
167 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
169 internal bool HasLocalTransactionFromAPI
170 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
172 internal bool IsKatmaiOrNewer
173 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
175 internal TdsParser Parser
176 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
178 internal void ValidateConnectionForExecute(string method
, SqlCommand command
)
179 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
181 internal static string FixupDatabaseTransactionName(string name
)
182 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
184 internal void OnError(SqlException exception
, bool breakConnection
, Action
<Action
> wrapCloseInAction
)
185 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
187 internal SqlInternalConnectionTds
GetOpenTdsConnection()
188 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
190 internal SqlInternalConnectionTds
GetOpenTdsConnection(string method
)
191 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
193 internal void OnInfoMessage(SqlInfoMessageEventArgs imevent
)
194 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
196 internal void OnInfoMessage(SqlInfoMessageEventArgs imevent
, out bool notified
)
197 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
199 internal void RegisterForConnectionCloseNotification
<T
>(ref Task
<T
> outerTask
, object value, int tag
)
200 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
202 public void ResetStatistics()
203 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
205 public IDictionary
RetrieveStatistics()
206 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
208 object ICloneable
.Clone()
209 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
211 internal void CheckGetExtendedUDTInfo(SqlMetaDataPriv metaData
, bool fThrow
)
212 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
214 internal object GetUdtValue(object value, SqlMetaDataPriv metaData
, bool returnDBNull
)
215 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
217 internal byte[] GetBytes(object o
)
218 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
220 internal byte[] GetBytes(object o
, out Format format
, out int maxSize
)
221 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
223 internal int CloseCount
224 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
226 internal DbConnectionFactory ConnectionFactory
227 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
229 internal DbConnectionOptions ConnectionOptions
230 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
233 internal DbConnectionInternal InnerConnection
234 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
236 internal System
.Data
.ProviderBase
.DbConnectionPoolGroup PoolGroup
{
237 get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
238 set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
241 internal DbConnectionOptions UserConnectionOptions
242 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
244 internal void Abort(Exception e
)
245 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
247 internal void AddWeakReference(object value, int tag
)
248 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
250 override protected DbCommand
CreateDbCommand()
251 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
253 override protected void Dispose(bool disposing
) {}
255 public override void EnlistTransaction(Transaction transaction
)
256 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
258 internal void NotifyWeakReference(int message
)
259 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
261 internal void PermissionDemand()
262 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
264 internal void RemoveWeakReference(object value)
265 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
267 internal void SetInnerConnectionEvent(DbConnectionInternal to
)
268 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
270 internal bool SetInnerConnectionFrom(DbConnectionInternal to
, DbConnectionInternal
from)
271 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);
273 internal void SetInnerConnectionTo(DbConnectionInternal to
)
274 => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE
);