Пример #1
0
        /// <summary>
        ///     Adds an operation to add a column to an existing table.  This is a wrapper for the default DBMigration AddColumn.
        /// </summary>
        /// <param name="table"> The name of the table to add the column to. Schema name is optional, if no schema is specified then dbo is assumed. </param>
        /// <param name="name"> The name of the column to be added. </param>
        /// <param name="columnAction"> An action that specifies the column to be added. i.e. c => c.Int(nullable: false, defaultValue: 3) </param>
        /// <param name="anonymousArguments"> Additional arguments that may be processed by providers. Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. </param>
        public void AddColumn(string table, string name, Func <ColumnBuilder, ColumnModel> columnAction, object anonymousArguments = null)
        {
            DbMigration dbMigration = new DbMigration();

            dbMigration.AddColumn(table, name, columnAction, anonymousArguments);
            Sql(dbMigration.GetMigrationSql(SqlConnection));
        }