SqlConnection.platformnotsupported.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  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.
  4. using System.Collections;
  5. using System.Data.Common;
  6. using System.Data.ProviderBase;
  7. using System.Diagnostics;
  8. using System.Threading;
  9. using System.Threading.Tasks;
  10. using System.Diagnostics.CodeAnalysis;
  11. using System.Transactions;
  12. using Microsoft.SqlServer.Server;
  13. using System.Reflection;
  14. using System.IO;
  15. using System.Globalization;
  16. using System.Security;
  17. namespace System.Data.SqlClient
  18. {
  19. public sealed partial class SqlConnection : DbConnection, ICloneable
  20. {
  21. const string EXCEPTION_MESSAGE = "System.Data.SqlClient.SqlConnection is not supported on the current platform.";
  22. internal SqlStatistics _statistics;
  23. internal Task _currentReconnectionTask;
  24. internal SessionData _recoverySessionData;
  25. internal bool _suppressStateChangeForReconnection;
  26. internal bool _applyTransientFaultHandling = false;
  27. public SqlConnection() : base() => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  28. public SqlConnection(string connectionString) : this() {}
  29. public bool StatisticsEnabled {
  30. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  31. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  32. }
  33. internal bool AsyncCommandInProgress {
  34. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  35. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  36. }
  37. internal SqlConnectionString.TransactionBindingEnum TransactionBinding
  38. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  39. internal SqlConnectionString.TypeSystem TypeSystem
  40. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  41. internal Version TypeSystemAssemblyVersion
  42. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  43. internal int ConnectRetryInterval
  44. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  45. public override string ConnectionString {
  46. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  47. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  48. }
  49. public override int ConnectionTimeout
  50. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  51. public override string Database
  52. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  53. public override string DataSource
  54. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  55. public int PacketSize
  56. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  57. public Guid ClientConnectionId
  58. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  59. public override string ServerVersion
  60. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  61. public override ConnectionState State
  62. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  63. internal SqlStatistics Statistics
  64. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  65. public string WorkstationId
  66. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  67. protected override DbProviderFactory DbProviderFactory
  68. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  69. public event SqlInfoMessageEventHandler InfoMessage;
  70. public bool FireInfoMessageEventOnUserErrors {
  71. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  72. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  73. }
  74. internal int ReconnectCount
  75. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  76. internal bool ForceNewConnection {
  77. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  78. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  79. }
  80. protected override void OnStateChange(StateChangeEventArgs stateChange)
  81. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  82. new public SqlTransaction BeginTransaction()
  83. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  84. new public SqlTransaction BeginTransaction(IsolationLevel iso)
  85. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  86. public SqlTransaction BeginTransaction(string transactionName)
  87. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  88. override protected DbTransaction BeginDbTransaction(IsolationLevel isolationLevel)
  89. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  90. public SqlTransaction BeginTransaction(IsolationLevel iso, string transactionName)
  91. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  92. public override void ChangeDatabase(string database)
  93. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  94. public static void ChangePassword(string connectionString, string newPassword)
  95. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  96. public static void ChangePassword(string connectionString, SqlCredential credential, SecureString newSecurePassword)
  97. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  98. public static void ClearAllPools()
  99. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  100. public static void ClearPool(SqlConnection connection)
  101. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  102. public override void Close()
  103. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  104. new public SqlCommand CreateCommand()
  105. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  106. public override void Open()
  107. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  108. internal void RegisterWaitingForReconnect(Task waitingTask)
  109. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  110. internal Task ValidateAndReconnect(Action beforeDisconnect, int timeout)
  111. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  112. public override Task OpenAsync(CancellationToken cancellationToken)
  113. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  114. public override DataTable GetSchema()
  115. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  116. public override DataTable GetSchema(string collectionName)
  117. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  118. public override DataTable GetSchema(string collectionName, string[] restrictionValues)
  119. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  120. internal bool HasLocalTransaction
  121. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  122. internal bool HasLocalTransactionFromAPI
  123. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  124. internal bool IsKatmaiOrNewer
  125. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  126. internal TdsParser Parser
  127. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  128. internal void ValidateConnectionForExecute(string method, SqlCommand command)
  129. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  130. internal static string FixupDatabaseTransactionName(string name)
  131. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  132. internal void OnError(SqlException exception, bool breakConnection, Action<Action> wrapCloseInAction)
  133. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  134. internal SqlInternalConnectionTds GetOpenTdsConnection()
  135. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  136. internal SqlInternalConnectionTds GetOpenTdsConnection(string method)
  137. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  138. internal void OnInfoMessage(SqlInfoMessageEventArgs imevent)
  139. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  140. internal void OnInfoMessage(SqlInfoMessageEventArgs imevent, out bool notified)
  141. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  142. internal void RegisterForConnectionCloseNotification<T>(ref Task<T> outerTask, object value, int tag)
  143. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  144. public void ResetStatistics()
  145. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  146. public IDictionary RetrieveStatistics()
  147. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  148. object ICloneable.Clone()
  149. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  150. internal void CheckGetExtendedUDTInfo(SqlMetaDataPriv metaData, bool fThrow)
  151. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  152. internal object GetUdtValue(object value, SqlMetaDataPriv metaData, bool returnDBNull)
  153. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  154. internal byte[] GetBytes(object o)
  155. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  156. internal byte[] GetBytes(object o, out Format format, out int maxSize)
  157. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  158. internal int CloseCount
  159. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  160. internal DbConnectionFactory ConnectionFactory
  161. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  162. internal DbConnectionOptions ConnectionOptions
  163. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  164. internal DbConnectionInternal InnerConnection
  165. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  166. internal System.Data.ProviderBase.DbConnectionPoolGroup PoolGroup {
  167. get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  168. set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  169. }
  170. internal DbConnectionOptions UserConnectionOptions
  171. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  172. internal void Abort(Exception e)
  173. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  174. internal void AddWeakReference(object value, int tag)
  175. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  176. override protected DbCommand CreateDbCommand()
  177. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  178. override protected void Dispose(bool disposing) {}
  179. public override void EnlistTransaction(Transaction transaction)
  180. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  181. internal void NotifyWeakReference(int message)
  182. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  183. internal void PermissionDemand()
  184. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  185. internal void RemoveWeakReference(object value)
  186. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  187. internal void SetInnerConnectionEvent(DbConnectionInternal to)
  188. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  189. internal bool SetInnerConnectionFrom(DbConnectionInternal to, DbConnectionInternal from)
  190. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  191. internal void SetInnerConnectionTo(DbConnectionInternal to)
  192. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  193. }
  194. }