Ejemplo n.º 1
0
        public virtual string GetInsertScript([NotNull] HistoryRow row)
        {
            Check.NotNull(row, nameof(row));

            return(new StringBuilder().Append("INSERT INTO ")
                   .Append(SqlGenerationHelper.DelimitIdentifier(TableName, TableSchema))
                   .Append(" (")
                   .Append(SqlGenerationHelper.DelimitIdentifier(MigrationIdColumnName))
                   .Append(", ")
                   .Append(SqlGenerationHelper.DelimitIdentifier(ProductVersionColumnName))
                   .AppendLine(")")
                   .Append("VALUES ('")
                   .Append(SqlGenerationHelper.EscapeLiteral(row.MigrationId))
                   .Append("', '")
                   .Append(SqlGenerationHelper.EscapeLiteral(row.ProductVersion))
                   .AppendLine("');")
                   .ToString());
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Generates a SQL script to insert a row into the history table.
        /// </summary>
        /// <param name="row">The row to insert, represented as a <see cref="HistoryRow" /> entity.</param>
        /// <returns>The generated SQL.</returns>
        public virtual string GetInsertScript(HistoryRow row)
        {
            var stringTypeMapping = Dependencies.TypeMappingSource.GetMapping(typeof(string));

            return(new StringBuilder().Append("INSERT INTO ")
                   .Append(SqlGenerationHelper.DelimitIdentifier(TableName, TableSchema))
                   .Append(" (")
                   .Append(SqlGenerationHelper.DelimitIdentifier(MigrationIdColumnName))
                   .Append(", ")
                   .Append(SqlGenerationHelper.DelimitIdentifier(ProductVersionColumnName))
                   .AppendLine(")")
                   .Append("VALUES (")
                   .Append(stringTypeMapping.GenerateSqlLiteral(row.MigrationId))
                   .Append(", ")
                   .Append(stringTypeMapping.GenerateSqlLiteral(row.ProductVersion))
                   .Append(')')
                   .AppendLine(SqlGenerationHelper.StatementTerminator)
                   .ToString());
        }
Ejemplo n.º 3
0
        public virtual string GetInsertScript(HistoryRow row)
        {
            Check.NotNull(row, nameof(row));

            return new StringBuilder().Append("INSERT INTO ")
                .Append(SqlGenerationHelper.DelimitIdentifier(TableName, TableSchema))
                .Append(" (")
                .Append(SqlGenerationHelper.DelimitIdentifier(MigrationIdColumnName))
                .Append(", ")
                .Append(SqlGenerationHelper.DelimitIdentifier(ProductVersionColumnName))
                .AppendLine(")")
                .Append("VALUES ('")
                .Append(SqlGenerationHelper.EscapeLiteral(row.MigrationId))
                .Append("', '")
                .Append(SqlGenerationHelper.EscapeLiteral(row.ProductVersion))
                .AppendLine("');")
                .ToString();
        }