SqlBulkCopy.platformnotsupported.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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.Collections.Generic;
  6. using System.Data.Common;
  7. using System.Data.SqlTypes;
  8. using System.Diagnostics;
  9. using System.Text;
  10. using System.Threading;
  11. using System.Threading.Tasks;
  12. using System.Xml;
  13. namespace System.Data.SqlClient
  14. {
  15. public sealed class SqlBulkCopy : IDisposable
  16. {
  17. const string EXCEPTION_MESSAGE = "System.Data.SqlClient.SqlBulkCopy is not supported on the current platform.";
  18. public SqlBulkCopy(SqlConnection connection)
  19. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  20. public SqlBulkCopy(SqlConnection connection, SqlBulkCopyOptions copyOptions, SqlTransaction externalTransaction)
  21. : this(connection)
  22. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  23. public SqlBulkCopy(string connectionString) : this(new SqlConnection(connectionString))
  24. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  25. public SqlBulkCopy(string connectionString, SqlBulkCopyOptions copyOptions)
  26. : this(connectionString)
  27. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  28. public int BatchSize {
  29. get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  30. set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  31. }
  32. public int BulkCopyTimeout {
  33. get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  34. set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  35. }
  36. public bool EnableStreaming {
  37. get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  38. set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  39. }
  40. public SqlBulkCopyColumnMappingCollection ColumnMappings
  41. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  42. public string DestinationTableName {
  43. get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  44. set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  45. }
  46. public int NotifyAfter {
  47. get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  48. set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  49. }
  50. public event SqlRowsCopiedEventHandler SqlRowsCopied;
  51. internal SqlStatistics Statistics
  52. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  53. void IDisposable.Dispose() {}
  54. public void Close()
  55. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  56. public void WriteToServer(DbDataReader reader)
  57. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  58. public void WriteToServer(IDataReader reader)
  59. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  60. public void WriteToServer(DataTable table)
  61. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  62. public void WriteToServer(DataTable table, DataRowState rowState)
  63. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  64. public void WriteToServer(DataRow[] rows)
  65. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  66. public Task WriteToServerAsync(DataRow[] rows)
  67. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  68. public Task WriteToServerAsync(DataRow[] rows, CancellationToken cancellationToken)
  69. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  70. public Task WriteToServerAsync(DbDataReader reader)
  71. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  72. public Task WriteToServerAsync(DbDataReader reader, CancellationToken cancellationToken)
  73. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  74. public Task WriteToServerAsync(IDataReader reader)
  75. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  76. public Task WriteToServerAsync(IDataReader reader, CancellationToken cancellationToken)
  77. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  78. public Task WriteToServerAsync(DataTable table)
  79. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  80. public Task WriteToServerAsync(DataTable table, CancellationToken cancellationToken)
  81. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  82. public Task WriteToServerAsync(DataTable table, DataRowState rowState)
  83. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  84. public Task WriteToServerAsync(DataTable table, DataRowState rowState, CancellationToken cancellationToken)
  85. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  86. internal void OnConnectionClosed()
  87. => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  88. #if DEBUG
  89. internal static bool _setAlwaysTaskOnWrite = false;
  90. internal static bool SetAlwaysTaskOnWrite {
  91. get => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  92. set => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  93. }
  94. #endif
  95. }
  96. internal sealed class _ColumnMapping
  97. {
  98. internal int _sourceColumnOrdinal;
  99. internal _SqlMetaData _metadata;
  100. internal _ColumnMapping(int columnId, _SqlMetaData metadata) {}
  101. }
  102. internal sealed class Row
  103. {
  104. internal Row(int rowCount) {}
  105. internal object[] DataFields => null;
  106. internal object this[int index] => null;
  107. }
  108. internal sealed class Result
  109. {
  110. internal Result(_SqlMetaDataSet metadata) {}
  111. internal int Count => 0;
  112. internal _SqlMetaDataSet MetaData => null;
  113. internal Row this[int index] => null;
  114. internal void AddRow(Row row) {}
  115. }
  116. internal sealed class BulkCopySimpleResultSet
  117. {
  118. internal BulkCopySimpleResultSet() {}
  119. internal Result this[int idx] => null;
  120. internal void SetMetaData(_SqlMetaDataSet metadata) {}
  121. internal int[] CreateIndexMap() => null;
  122. internal object[] CreateRowBuffer() => null;
  123. }
  124. }