示例#1
0
文件: Import.cs 项目: gerakul/FastSql
 public async Task ExecuteAsync(CancellationToken cancellationToken, ImportOptions options, string commandText, string destinationTable, params object[] commandParameters)
 {
     SqlScope scope = TransactionFrom == null ? new SqlScope(ConnectionFrom) : new SqlScope(TransactionFrom);
     using (DbDataReader reader = await scope.CreateSimple(options.QueryOptions, commandText, commandParameters).ExecuteReaderAsync(cancellationToken).ConfigureAwait(false))
     {
         if (TransactionTo == null)
         {
             await reader.WriteToServerAsync(cancellationToken, options.BulkOptions, ConnectionTo, destinationTable).ConfigureAwait(false);
         }
         else
         {
             await reader.WriteToServerAsync(cancellationToken, options.BulkOptions, TransactionTo, destinationTable).ConfigureAwait(false);
         }
     }
 }
示例#2
0
文件: Import.cs 项目: gerakul/FastSql
 public void Execute(ImportOptions options, string commandText, string destinationTable, params object[] commandParameters)
 {
     SqlScope scope = TransactionFrom == null ? new SqlScope(ConnectionFrom) : new SqlScope(TransactionFrom);
     using (DbDataReader reader = scope.CreateSimple(options.QueryOptions, commandText, commandParameters).ExecuteReader())
     {
         if (TransactionTo == null)
         {
             reader.WriteToServer(options.BulkOptions, ConnectionTo, destinationTable);
         }
         else
         {
             reader.WriteToServer(options.BulkOptions, TransactionTo, destinationTable);
         }
     }
 }
示例#3
0
文件: Import.cs 项目: gerakul/FastSql
 public Task ExecuteAsync(ImportOptions options, string commandText, string destinationTable, params object[] commandParameters)
 {
     return ExecuteAsync(CancellationToken.None, options, commandText, destinationTable, commandParameters);
 }
示例#4
0
文件: Import.cs 项目: gerakul/FastSql
        public static async Task ExecuteAsync(CancellationToken cancellationToken, ImportOptions options,
          string connectionStringFrom, string connectionStringTo, string commandText, string destinationTable, params object[] commandParameters)
        {
            using (SqlConnection connFrom = new SqlConnection(connectionStringFrom))
            {
                await connFrom.OpenAsync().ConfigureAwait(false);

                using (SqlConnection connTo = new SqlConnection(connectionStringTo))
                {
                    await connTo.OpenAsync().ConfigureAwait(false);

                    Import import = new Import(connFrom, connTo);
                    await import.ExecuteAsync(cancellationToken, options, commandText, destinationTable, commandParameters).ConfigureAwait(false);
                }
            }
        }
示例#5
0
文件: Import.cs 项目: gerakul/FastSql
        public static void Execute(ImportOptions options, string connectionStringFrom, string connectionStringTo, string commandText, string destinationTable, params object[] commandParameters)
        {
            using (SqlConnection connFrom = new SqlConnection(connectionStringFrom))
            {
                connFrom.Open();

                using (SqlConnection connTo = new SqlConnection(connectionStringTo))
                {
                    connTo.Open();

                    Import import = new Import(connFrom, connTo);
                    import.Execute(options, commandText, destinationTable, commandParameters);
                }
            }
        }