public void Prepare(WriteToTableMutator process, DetailedDbTableDefinition tableDefinition)
        {
            _tableDefinition = tableDefinition;

            _allDbColumns          = string.Join(", ", _tableDefinition.Columns.Select(x => x.DbColumn));
            _keyDbColumns          = string.Join(" AND ", _tableDefinition.Columns.Where(x => x.IsKey).Select(x => "target." + x.DbColumn + " = source." + x.DbColumn));
            _updateDbColumns       = string.Join(",\n\t\t", _tableDefinition.Columns.Where(x => !x.IsKey).Select(x => x.DbColumn + " = source." + x.DbColumn));
            _insertDbColumnsTarget = string.Join(", ", _tableDefinition.Columns.Where(x => x.Insert).Select(x => x.DbColumn));
            _insertDbColumnsSource = string.Join(", ", _tableDefinition.Columns.Where(x => x.Insert).Select(x => "source." + x.DbColumn));
        }
        public string CreateRowStatement(NamedConnectionString connectionString, IReadOnlySlimRow row, WriteToTableMutator operation)
        {
            var startIndex = operation.ParameterCount;

            foreach (var column in _tableDefinition.Columns)
            {
                operation.CreateParameter(column, row[column.RowColumn]);
            }

            var statement = "(" + string.Join(", ", _tableDefinition.Columns.Select(_ => "@" + startIndex++.ToString("D", CultureInfo.InvariantCulture))) + ")";

            return(statement);
        }
 public void Prepare(WriteToTableMutator process, DetailedDbTableDefinition tableDefinition)
 {
     _tableDefinition = tableDefinition;
     _columns         = _tableDefinition.Columns.Where(x => x.Insert).ToArray();
     _dbColumns       = string.Join(", ", _columns.Select(x => x.DbColumn));
 }