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