コード例 #1
0
ファイル: Importer.cs プロジェクト: cagomezt/So-Slow
        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);
        }
コード例 #2
0
ファイル: Importer.cs プロジェクト: xusun/So-Slow
        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);
        }