Exemple #1
0
        private void BulkExecute(DataTable table, BulkCommandText commandText)
        {
            var tableName = string.Format("#Temp{0}", DateTimeHelper.GetTimestamp());

            commandText.TableCommandText = commandText.TableCommandText.Replace("@TableName", tableName);
            Execute(commandText.TableCommandText);

            WriteToServer(tableName, table);

            commandText.ExecutionCommandText = commandText.ExecutionCommandText.Replace("@TableName", tableName);
            Execute(commandText.ExecutionCommandText);
        }
Exemple #2
0
        private BulkCommandText GetBulkDeleteCommandText(Type type, string tableKey, string executionKey)
        {
            var tableCommandText     = CommandTextCache.GetCachedCommandText(tableKey);
            var executionCommandText = CommandTextCache.GetCachedCommandText(executionKey);
            var commandText          = new BulkCommandText(tableCommandText, executionCommandText);

            if (string.IsNullOrEmpty(tableCommandText) || string.IsNullOrEmpty(executionCommandText))
            {
                var dbEntity  = DbEntityCache.GetDbEntity(type);
                var dbColumns = GetDbColumns(dbEntity.Name).Where(dbColumn => !DbConst.BulkUpdateExcludedColumns.Contains(dbColumn.Name));

                commandText.TableCommandText     = CommandTextCache.GetBulkTableCommandText(tableKey, dbColumns);
                commandText.ExecutionCommandText = CommandTextCache.GetBulkDeleteCommandText(executionKey, dbEntity);
            }

            return(commandText);
        }