public static SQLDBAccess Create(DbConnection conn) { var result = new SQLDBAccess(); result.Configure(conn); return(result); }
public DefaultBulkCopy(string destinationTableName) { _conn = new SqlConnection(ConfigurationManager.ConnectionStrings["cnSselData"].ConnectionString); var dba = SQLDBAccess.Create(_conn); if (!(dba.Connection is SqlConnection)) { throw new NotSupportedException("Only SqlConnection type is supported."); } if (!(dba.Transaction is SqlTransaction)) { throw new NotSupportedException("Only SqlTransaction type is supported."); } _trans = dba.Transaction as SqlTransaction; //SqlBulkCopyOptions options = SqlBulkCopyOptions.TableLock; SqlBulkCopyOptions options = SqlBulkCopyOptions.Default; _bcp = new SqlBulkCopy(_conn, options, _trans) { DestinationTableName = destinationTableName, BatchSize = 5000 }; }