public void Import() { SqlBulkCopy copy = new SqlBulkCopy(connection, SqlBulkCopyOptions.TableLock , null); copy.DestinationTableName = targetTable; copy.NotifyAfter = NotifyPerRows; copy.SqlRowsCopied += new SqlRowsCopiedEventHandler(copy_SqlRowsCopied); copy.BatchSize = NotifyPerRows; // TODO: Extract this further up var validator = (ColumnValidator)null; if (targetTable.ToLower() == "comments") { validator = CommentsValidator; } if (targetTable.ToLower() == "posts") { validator = ViewCountValidator; } //targetTable == "Comments" ? CommentsValidator : (ColumnValidator)null; var dumpReader = new DumpReader(filename, targetTable, connection, validator); copy.WriteToServer(dumpReader); }
public void Import() { SqlBulkCopy copy = new SqlBulkCopy(connection, SqlBulkCopyOptions.TableLock, null); copy.DestinationTableName = targetTable; copy.NotifyAfter = NotifyPerRows; copy.SqlRowsCopied += new SqlRowsCopiedEventHandler(copy_SqlRowsCopied); copy.BatchSize = NotifyPerRows; // TODO: Extract this further up var validator = (ColumnValidator)null; if (targetTable.ToLower() == "comments") { validator = CommentsValidator; } if (targetTable.ToLower() == "posts") { validator = ViewCountValidator; } //targetTable == "Comments" ? CommentsValidator : (ColumnValidator)null; var dumpReader = new DumpReader(filename, targetTable, connection, validator); copy.WriteToServer(dumpReader); }