예제 #1
0
        public Task WriteToServerAsync(string destinationTable, BulkOptions bulkOptions, CancellationToken cancellationToken, params string[] fields)
        {
            BulkCopy bulk = scopedContext.ContextProvider.GetBulkCopy(scopedContext, reader, destinationTable,
                                                                      scopedContext.PrepareBulkOptions(bulkOptions), fields);

            return(bulk.WriteToServerAsync(cancellationToken));
        }
예제 #2
0
 public void WriteToServer(string destinationTable, BulkOptions bulkOptions, params string[] fields)
 {
     connectionStringContext.UsingConnection(x =>
     {
         reader.GetBulkWriter(x).WriteToServer(destinationTable, bulkOptions, fields);
     });
 }
예제 #3
0
        public void WriteToServer(string destinationTable, BulkOptions bulkOptions, params string[] fields)
        {
            BulkCopy bulk = scopedContext.ContextProvider.GetBulkCopy(scopedContext, reader, destinationTable,
                                                                      scopedContext.PrepareBulkOptions(bulkOptions), fields);

            bulk.WriteToServer();
        }
예제 #4
0
 public async Task WriteToServerAsync(string destinationTable, BulkOptions bulkOptions, CancellationToken cancellationToken, params string[] fields)
 {
     await connectionStringContext.UsingConnectionAsync(async x =>
     {
         await reader.GetBulkWriter(x).WriteToServerAsync(destinationTable, bulkOptions, cancellationToken, fields).ConfigureAwait(false);
     }).ConfigureAwait(false);
 }
예제 #5
0
 protected internal DbContext(ContextProvider contextProvider,
                              QueryOptions queryOptions, BulkOptions bulkOptions, ReadOptions readOptions)
 {
     this.ContextProvider = contextProvider;
     this.QueryOptions    = queryOptions.Clone();
     this.BulkOptions     = bulkOptions.Clone();
     this.ReadOptions     = readOptions.Clone();
 }
예제 #6
0
 protected BulkCopy(ScopedContext context, DbDataReader reader, string destinationTable, BulkOptions bulkOptions, params string[] fields)
 {
     this.context          = context;
     this.bulkOptions      = bulkOptions;
     this.destinationTable = destinationTable;
     this.reader           = reader;
     this.fields           = fields;
 }
예제 #7
0
        internal BulkOptions PrepareBulkOptions(BulkOptions options)
        {
            if (options == null)
            {
                return(BulkOptions.Clone().SetDefaults());
            }

            var opt = ContextProvider.GetTyped(options, out var needClone);

            if (needClone)
            {
                opt = opt.Clone();
            }

            return(opt.SetDefaults(BulkOptions).SetDefaults());
        }
예제 #8
0
 protected internal TransactionContext(ContextProvider contextProvider, DbTransaction transaction,
                                       QueryOptions queryOptions, BulkOptions bulkOptions, ReadOptions readOptions)
     : base(contextProvider, queryOptions, bulkOptions, readOptions)
 {
     this.Transaction = transaction;
 }
예제 #9
0
 protected internal ConnectionContext(ContextProvider contextProvider, DbConnection connection,
                                      QueryOptions queryOptions, BulkOptions bulkOptions, ReadOptions readOptions)
     : base(contextProvider, queryOptions, bulkOptions, readOptions)
 {
     this.Connection = connection;
 }
예제 #10
0
 protected internal ConnectionStringContext(ContextProvider contextProvider, string connectionString,
                                            QueryOptions queryOptions, BulkOptions bulkOptions, ReadOptions readOptions)
     : base(contextProvider, queryOptions, bulkOptions, readOptions)
 {
     this.ConnectionString = connectionString;
 }
예제 #11
0
 public static void WriteToServer(this IWrappedCommand cmd, DbContext context, string destinationTable, BulkOptions bulkOptions, params string[] fields)
 {
     cmd.UseReader(x => x.WriteToServer(context, destinationTable, bulkOptions, fields));
 }
예제 #12
0
 public static Task WriteToServerAsync(this IWrappedCommand cmd, DbContext context, string destinationTable, BulkOptions bulkOptions, params string[] fields)
 {
     return(cmd.UseReaderAsync(x => x.WriteToServerAsync(context, destinationTable, bulkOptions, fields)));
 }
예제 #13
0
 public static Task WriteToServerAsync(this IBulkWriter writer, string destinationTable, BulkOptions bulkOptions, params string[] fields)
 {
     return(writer.WriteToServerAsync(destinationTable, bulkOptions, CancellationToken.None, fields));
 }
예제 #14
0
 protected internal abstract ConnectionStringContext GetConnectionStringContext(string connectionString,
                                                                                QueryOptions queryOptions, BulkOptions bulkOptions, ReadOptions readOptions);
예제 #15
0
 public static Task WriteToServerAsync <T>(this IEnumerable <T> values, DbContext context, string destinationTable, BulkOptions bulkOptions, params string[] fields)
 {
     return(values.ToDataReader().WriteToServerAsync(context, destinationTable, bulkOptions, fields));
 }
예제 #16
0
 public static void WriteToServer <T>(this IEnumerable <T> values, DbContext context, string destinationTable, BulkOptions bulkOptions, params string[] fields)
 {
     values.ToDataReader().WriteToServer(context, destinationTable, bulkOptions, fields);
 }
예제 #17
0
 protected internal ScopedContext(ContextProvider contextProvider,
                                  QueryOptions queryOptions, BulkOptions bulkOptions, ReadOptions readOptions)
     : base(contextProvider, queryOptions, bulkOptions, readOptions)
 {
 }
예제 #18
0
 public static Task WriteToServerAsync(this DbDataReader reader, DbContext context, string destinationTable, BulkOptions bulkOptions, params string[] fields)
 {
     return(reader.GetBulkWriter(context).WriteToServerAsync(destinationTable, bulkOptions, fields));
 }
예제 #19
0
 protected internal abstract BulkOptions GetTyped(BulkOptions options, out bool needClone);
예제 #20
0
 protected internal abstract BulkCopy GetBulkCopy(ScopedContext context, DbDataReader reader, string destinationTable, BulkOptions bulkOptions, params string[] fields);
예제 #21
0
 protected internal abstract TransactionContext GetTransactionContext(DbTransaction transaction,
                                                                      QueryOptions queryOptions, BulkOptions bulkOptions, ReadOptions readOptions);
예제 #22
0
 protected internal abstract ConnectionContext GetConnectionContext(DbConnection connection,
                                                                    QueryOptions queryOptions, BulkOptions bulkOptions, ReadOptions readOptions);