删除字段:
1.去除表类字段,
执行Add-Migration deletetest
生成类:
namespace MyBlogNew.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class deletetest : DbMigration
{
public override void Up()
{
DropColumn("dbo.diary", "Test");
}
public override void Down()
{
AddColumn("dbo.diary", "Test", c => c.Int(nullable: false));
}
}
}
执行Update-Database
当有其他修改,但该类并不能完成需求更改时,可直接修改该类,执行Update-Database。
基类:
#region 程序集 EntityFramework.dll, v6.0.0.0
// F:\MyBlogNew\MyBlogNewApi\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll
#endregion
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data.Entity.Migrations.Builders;
using System.Data.Entity.Migrations.Infrastructure;
using System.Data.Entity.Migrations.Model;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
namespace System.Data.Entity.Migrations
{
// 摘要:
// Base class for code-based migrations. Entity Framework Migrations APIs are
// not designed to accept input provided by untrusted sources (such as the end
// user of an application). If input is accepted from such sources it should
// be validated before being passed to these APIs to protect against SQL injection
// attacks etc.
public abstract class DbMigration : IDbMigration
{
protected DbMigration();
// 摘要:
// Adds an operation to add a column to an existing table. Entity Framework
// Migrations APIs are not designed to accept input provided by untrusted sources
// (such as the end user of an application). If input is accepted from such
// sources it should be validated before being passed to these APIs to protect
// against SQL injection attacks etc.
//
// 参数:
// table:
// The name of the table to add the column to. Schema name is optional, if no
// schema is specified then dbo is assumed.
//
// name:
// The name of the column to be added.
//
// columnAction:
// An action that specifies the column to be added. i.e. c => c.Int(nullable:
// false, defaultValue: 3)
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void AddColumn(string table, string name, Func<ColumnBuilder, ColumnModel> columnAction, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to create a new foreign key constraint. Entity Framework
// Migrations APIs are not designed to accept input provided by untrusted sources
// (such as the end user of an application). If input is accepted from such
// sources it should be validated before being passed to these APIs to protect
// against SQL injection attacks etc.
//
// 参数:
// dependentTable:
// The table that contains the foreign key column. Schema name is optional,
// if no schema is specified then dbo is assumed.
//
// dependentColumn:
// The foreign key column.
//
// principalTable:
// The table that contains the column this foreign key references. Schema name
// is optional, if no schema is specified then dbo is assumed.
//
// principalColumn:
// The column this foreign key references. If no value is supplied the primary
// key of the principal table will be referenced.
//
// cascadeDelete:
// A value indicating if cascade delete should be configured for the foreign
// key relationship. If no value is supplied, cascade delete will be off.
//
// name:
// The name of the foreign key constraint in the database. If no value is supplied
// a unique name will be generated.
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void AddForeignKey(string dependentTable, string dependentColumn, string principalTable, string principalColumn = null, bool cascadeDelete = false, string name = null, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to create a new foreign key constraint. Entity Framework
// Migrations APIs are not designed to accept input provided by untrusted sources
// (such as the end user of an application). If input is accepted from such
// sources it should be validated before being passed to these APIs to protect
// against SQL injection attacks etc.
//
// 参数:
// dependentTable:
// The table that contains the foreign key columns. Schema name is optional,
// if no schema is specified then dbo is assumed.
//
// dependentColumns:
// The foreign key columns.
//
// principalTable:
// The table that contains the columns this foreign key references. Schema name
// is optional, if no schema is specified then dbo is assumed.
//
// principalColumns:
// The columns this foreign key references. If no value is supplied the primary
// key of the principal table will be referenced.
//
// cascadeDelete:
// A value indicating if cascade delete should be configured for the foreign
// key relationship. If no value is supplied, cascade delete will be off.
//
// name:
// The name of the foreign key constraint in the database. If no value is supplied
// a unique name will be generated.
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void AddForeignKey(string dependentTable, string[] dependentColumns, string principalTable, string[] principalColumns = null, bool cascadeDelete = false, string name = null, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to create a new primary key. Entity Framework Migrations
// APIs are not designed to accept input provided by untrusted sources (such
// as the end user of an application). If input is accepted from such sources
// it should be validated before being passed to these APIs to protect against
// SQL injection attacks etc.
//
// 参数:
// table:
// The table that contains the primary key column. Schema name is optional,
// if no schema is specified then dbo is assumed.
//
// column:
// The primary key column.
//
// name:
// The name of the primary key in the database. If no value is supplied a unique
// name will be generated.
//
// clustered:
// A value indicating whether or not this is a clustered primary key.
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void AddPrimaryKey(string table, string column, string name = null, bool clustered = true, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to create a new primary key based on multiple columns.
// Entity Framework Migrations APIs are not designed to accept input provided
// by untrusted sources (such as the end user of an application). If input is
// accepted from such sources it should be validated before being passed to
// these APIs to protect against SQL injection attacks etc.
//
// 参数:
// table:
// The table that contains the primary key columns. Schema name is optional,
// if no schema is specified then dbo is assumed.
//
// columns:
// The primary key columns.
//
// name:
// The name of the primary key in the database. If no value is supplied a unique
// name will be generated.
//
// clustered:
// A value indicating whether or not this is a clustered primary key.
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void AddPrimaryKey(string table, string[] columns, string name = null, bool clustered = true, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to alter the definition of an existing column. Entity
// Framework Migrations APIs are not designed to accept input provided by untrusted
// sources (such as the end user of an application). If input is accepted from
// such sources it should be validated before being passed to these APIs to
// protect against SQL injection attacks etc.
//
// 参数:
// table:
// The name of the table the column exists in. Schema name is optional, if no
// schema is specified then dbo is assumed.
//
// name:
// The name of the column to be changed.
//
// columnAction:
// An action that specifies the new definition for the column. i.e. c => c.String(nullable:
// false, defaultValue: "none")
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void AlterColumn(string table, string name, Func<ColumnBuilder, ColumnModel> columnAction, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to alter a stored procedure. Entity Framework Migrations
// APIs are not designed to accept input provided by untrusted sources (such
// as the end user of an application). If input is accepted from such sources
// it should be validated before being passed to these APIs to protect against
// SQL injection attacks etc.
//
// 参数:
// name:
// The name of the stored procedure. Schema name is optional, if no schema is
// specified then dbo is assumed.
//
// body:
// The body of the stored procedure.
//
// anonymousArguments:
// The additional arguments that may be processed by providers. Use anonymous
// type syntax to specify arguments. For example, 'new { SampleArgument = "MyValue"
// }'.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
public void AlterStoredProcedure(string name, string body, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to alter a stored procedure. Entity Framework Migrations
// APIs are not designed to accept input provided by untrusted sources (such
// as the end user of an application). If input is accepted from such sources
// it should be validated before being passed to these APIs to protect against
// SQL injection attacks etc.
//
// 参数:
// name:
// The name of the stored procedure. Schema name is optional, if no schema is
// specified then dbo is assumed.
//
// parametersAction:
// The action that specifies the parameters of the stored procedure.
//
// body:
// The body of the stored procedure.
//
// anonymousArguments:
// The additional arguments that may be processed by providers. Use anonymous
// type syntax to specify arguments. For example, 'new { SampleArgument = "MyValue"
// }'.
//
// 类型参数:
// TParameters:
// The parameters in this alter stored procedure operation. You do not need
// to specify this type, it will be inferred from the parametersAction parameter
// you supply.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
public void AlterStoredProcedure<TParameters>(string name, Func<ParameterBuilder, TParameters> parametersAction, string body, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to handle changes in the annotations defined on tables.
// Entity Framework Migrations APIs are not designed to accept input provided
// by untrusted sources (such as the end user of an application). If input is
// accepted from such sources it should be validated before being passed to
// these APIs to protect against SQL injection attacks etc.
//
// 参数:
// name:
// The name of the table. Schema name is optional, if no schema is specified
// then dbo is assumed.
//
// columnsAction:
// An action that specifies the columns to be included in the table. i.e. t
// => new { Id = t.Int(identity: true), Name = t.String() }
//
// annotations:
// The custom annotations on the table that have changed.
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
//
// 类型参数:
// TColumns:
// The columns in this operation. You do not need to specify this type, it will
// be inferred from the columnsAction parameter you supply.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void AlterTableAnnotations<TColumns>(string name, Func<ColumnBuilder, TColumns> columnsAction, IDictionary<string, Data.Entity.Infrastructure.Annotations.AnnotationValues> annotations, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to create an index on a single column. Entity Framework
// Migrations APIs are not designed to accept input provided by untrusted sources
// (such as the end user of an application). If input is accepted from such
// sources it should be validated before being passed to these APIs to protect
// against SQL injection attacks etc.
//
// 参数:
// table:
// The name of the table to create the index on. Schema name is optional, if
// no schema is specified then dbo is assumed.
//
// column:
// The name of the column to create the index on.
//
// unique:
// A value indicating if this is a unique index. If no value is supplied a non-unique
// index will be created.
//
// name:
// The name to use for the index in the database. If no value is supplied a
// unique name will be generated.
//
// clustered:
// A value indicating whether or not this is a clustered index.
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void CreateIndex(string table, string column, bool unique = false, string name = null, bool clustered = false, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to create an index on multiple columns. Entity Framework
// Migrations APIs are not designed to accept input provided by untrusted sources
// (such as the end user of an application). If input is accepted from such
// sources it should be validated before being passed to these APIs to protect
// against SQL injection attacks etc.
//
// 参数:
// table:
// The name of the table to create the index on. Schema name is optional, if
// no schema is specified then dbo is assumed.
//
// columns:
// The name of the columns to create the index on.
//
// unique:
// A value indicating if this is a unique index. If no value is supplied a non-unique
// index will be created.
//
// name:
// The name to use for the index in the database. If no value is supplied a
// unique name will be generated.
//
// clustered:
// A value indicating whether or not this is a clustered index.
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void CreateIndex(string table, string[] columns, bool unique = false, string name = null, bool clustered = false, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to create a new stored procedure. Entity Framework Migrations
// APIs are not designed to accept input provided by untrusted sources (such
// as the end user of an application). If input is accepted from such sources
// it should be validated before being passed to these APIs to protect against
// SQL injection attacks etc.
//
// 参数:
// name:
// The name of the stored procedure. Schema name is optional, if no schema is
// specified then dbo is assumed.
//
// body:
// The body of the stored procedure.
//
// anonymousArguments:
// The additional arguments that may be processed by providers. Use anonymous
// type syntax to specify arguments. For example, 'new { SampleArgument = "MyValue"
// }'.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
public void CreateStoredProcedure(string name, string body, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to create a new stored procedure. Entity Framework Migrations
// APIs are not designed to accept input provided by untrusted sources (such
// as the end user of an application). If input is accepted from such sources
// it should be validated before being passed to these APIs to protect against
// SQL injection attacks etc.
//
// 参数:
// name:
// The name of the stored procedure. Schema name is optional, if no schema is
// specified then dbo is assumed.
//
// parametersAction:
// The action that specifies the parameters of the stored procedure.
//
// body:
// The body of the stored procedure.
//
// anonymousArguments:
// The additional arguments that may be processed by providers. Use anonymous
// type syntax to specify arguments. For example, 'new { SampleArgument = "MyValue"
// }'.
//
// 类型参数:
// TParameters:
// The parameters in this create stored procedure operation. You do not need
// to specify this type, it will be inferred from the parametersAction parameter
// you supply.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
public void CreateStoredProcedure<TParameters>(string name, Func<ParameterBuilder, TParameters> parametersAction, string body, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to create a new table. Entity Framework Migrations APIs
// are not designed to accept input provided by untrusted sources (such as the
// end user of an application). If input is accepted from such sources it should
// be validated before being passed to these APIs to protect against SQL injection
// attacks etc.
//
// 参数:
// name:
// The name of the table. Schema name is optional, if no schema is specified
// then dbo is assumed.
//
// columnsAction:
// An action that specifies the columns to be included in the table. i.e. t
// => new { Id = t.Int(identity: true), Name = t.String() }
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
//
// 类型参数:
// TColumns:
// The columns in this create table operation. You do not need to specify this
// type, it will be inferred from the columnsAction parameter you supply.
//
// 返回结果:
// An object that allows further configuration of the table creation operation.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal TableBuilder<TColumns> CreateTable<TColumns>(string name, Func<ColumnBuilder, TColumns> columnsAction, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to create a new table. Entity Framework Migrations APIs
// are not designed to accept input provided by untrusted sources (such as the
// end user of an application). If input is accepted from such sources it should
// be validated before being passed to these APIs to protect against SQL injection
// attacks etc.
//
// 参数:
// name:
// The name of the table. Schema name is optional, if no schema is specified
// then dbo is assumed.
//
// columnsAction:
// An action that specifies the columns to be included in the table. i.e. t
// => new { Id = t.Int(identity: true), Name = t.String() }
//
// annotations:
// Custom annotations that exist on the table to be created. May be null or
// empty.
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
//
// 类型参数:
// TColumns:
// The columns in this create table operation. You do not need to specify this
// type, it will be inferred from the columnsAction parameter you supply.
//
// 返回结果:
// An object that allows further configuration of the table creation operation.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal TableBuilder<TColumns> CreateTable<TColumns>(string name, Func<ColumnBuilder, TColumns> columnsAction, IDictionary<string, object> annotations, object anonymousArguments = null);
//
// 摘要:
// Operations to be performed during the downgrade process.
public virtual void Down();
//
// 摘要:
// Adds an operation to drop an existing column. Entity Framework Migrations
// APIs are not designed to accept input provided by untrusted sources (such
// as the end user of an application). If input is accepted from such sources
// it should be validated before being passed to these APIs to protect against
// SQL injection attacks etc.
//
// 参数:
// table:
// The name of the table to drop the column from. Schema name is optional, if
// no schema is specified then dbo is assumed.
//
// name:
// The name of the column to be dropped.
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void DropColumn(string table, string name, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to drop an existing column. Entity Framework Migrations
// APIs are not designed to accept input provided by untrusted sources (such
// as the end user of an application). If input is accepted from such sources
// it should be validated before being passed to these APIs to protect against
// SQL injection attacks etc.
//
// 参数:
// table:
// The name of the table to drop the column from. Schema name is optional, if
// no schema is specified then dbo is assumed.
//
// name:
// The name of the column to be dropped.
//
// removedAnnotations:
// Custom annotations that exist on the column that is being dropped. May be
// null or empty.
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void DropColumn(string table, string name, IDictionary<string, object> removedAnnotations, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to drop a foreign key constraint based on its name. Entity
// Framework Migrations APIs are not designed to accept input provided by untrusted
// sources (such as the end user of an application). If input is accepted from
// such sources it should be validated before being passed to these APIs to
// protect against SQL injection attacks etc.
//
// 参数:
// dependentTable:
// The table that contains the foreign key column. Schema name is optional,
// if no schema is specified then dbo is assumed.
//
// name:
// The name of the foreign key constraint in the database.
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void DropForeignKey(string dependentTable, string name, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to drop a foreign key constraint based on the column it
// targets. Entity Framework Migrations APIs are not designed to accept input
// provided by untrusted sources (such as the end user of an application). If
// input is accepted from such sources it should be validated before being passed
// to these APIs to protect against SQL injection attacks etc.
//
// 参数:
// dependentTable:
// The table that contains the foreign key column. Schema name is optional,
// if no schema is specified then dbo is assumed.
//
// dependentColumn:
// The foreign key column.
//
// principalTable:
// The table that contains the column this foreign key references. Schema name
// is optional, if no schema is specified then dbo is assumed.
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void DropForeignKey(string dependentTable, string dependentColumn, string principalTable, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to drop a foreign key constraint based on the columns it
// targets. Entity Framework Migrations APIs are not designed to accept input
// provided by untrusted sources (such as the end user of an application). If
// input is accepted from such sources it should be validated before being passed
// to these APIs to protect against SQL injection attacks etc.
//
// 参数:
// dependentTable:
// The table that contains the foreign key columns. Schema name is optional,
// if no schema is specified then dbo is assumed.
//
// dependentColumns:
// The foreign key columns.
//
// principalTable:
// The table that contains the columns this foreign key references. Schema name
// is optional, if no schema is specified then dbo is assumed.
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void DropForeignKey(string dependentTable, string[] dependentColumns, string principalTable, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to drop a foreign key constraint based on the column it
// targets. Entity Framework Migrations APIs are not designed to accept input
// provided by untrusted sources (such as the end user of an application). If
// input is accepted from such sources it should be validated before being passed
// to these APIs to protect against SQL injection attacks etc.
//
// 参数:
// dependentTable:
// The table that contains the foreign key column. Schema name is optional,
// if no schema is specified then dbo is assumed.
//
// dependentColumn:
// The foreign key column.
//
// principalTable:
// The table that contains the column this foreign key references. Schema name
// is optional, if no schema is specified then dbo is assumed.
//
// principalColumn:
// The columns this foreign key references.
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
[Obsolete("The principalColumn parameter is no longer required and can be removed.")]
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
[SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "principalColumn")]
protected internal void DropForeignKey(string dependentTable, string dependentColumn, string principalTable, string principalColumn, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to drop an index based on its name. Entity Framework Migrations
// APIs are not designed to accept input provided by untrusted sources (such
// as the end user of an application). If input is accepted from such sources
// it should be validated before being passed to these APIs to protect against
// SQL injection attacks etc.
//
// 参数:
// table:
// The name of the table to drop the index from. Schema name is optional, if
// no schema is specified then dbo is assumed.
//
// name:
// The name of the index to be dropped.
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void DropIndex(string table, string name, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to drop an index based on the columns it targets. Entity
// Framework Migrations APIs are not designed to accept input provided by untrusted
// sources (such as the end user of an application). If input is accepted from
// such sources it should be validated before being passed to these APIs to
// protect against SQL injection attacks etc.
//
// 参数:
// table:
// The name of the table to drop the index from. Schema name is optional, if
// no schema is specified then dbo is assumed.
//
// columns:
// The name of the column(s) the index targets.
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void DropIndex(string table, string[] columns, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to drop an existing primary key that was created with the
// default name. Entity Framework Migrations APIs are not designed to accept
// input provided by untrusted sources (such as the end user of an application).
// If input is accepted from such sources it should be validated before being
// passed to these APIs to protect against SQL injection attacks etc.
//
// 参数:
// table:
// The table that contains the primary key column. Schema name is optional,
// if no schema is specified then dbo is assumed.
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void DropPrimaryKey(string table, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to drop an existing primary key that does not have the
// default name. Entity Framework Migrations APIs are not designed to accept
// input provided by untrusted sources (such as the end user of an application).
// If input is accepted from such sources it should be validated before being
// passed to these APIs to protect against SQL injection attacks etc.
//
// 参数:
// table:
// The table that contains the primary key column. Schema name is optional,
// if no schema is specified then dbo is assumed.
//
// name:
// The name of the primary key to be dropped.
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void DropPrimaryKey(string table, string name, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to drop an existing stored procedure with the specified
// name. Entity Framework Migrations APIs are not designed to accept input
// provided by untrusted sources (such as the end user of an application). If
// input is accepted from such sources it should be validated before being passed
// to these APIs to protect against SQL injection attacks etc.
//
// 参数:
// name:
// The name of the procedure to drop. Schema name is optional, if no schema
// is specified then dbo is assumed.
//
// anonymousArguments:
// The additional arguments that may be processed by providers. Use anonymous
// type syntax to specify arguments. For example, 'new { SampleArgument = "MyValue"
// }'.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
public void DropStoredProcedure(string name, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to drop a table. Entity Framework Migrations APIs are
// not designed to accept input provided by untrusted sources (such as the end
// user of an application). If input is accepted from such sources it should
// be validated before being passed to these APIs to protect against SQL injection
// attacks etc.
//
// 参数:
// name:
// The name of the table to be dropped. Schema name is optional, if no schema
// is specified then dbo is assumed.
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void DropTable(string name, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to drop a table. Entity Framework Migrations APIs are
// not designed to accept input provided by untrusted sources (such as the end
// user of an application). If input is accepted from such sources it should
// be validated before being passed to these APIs to protect against SQL injection
// attacks etc.
//
// 参数:
// name:
// The name of the table to be dropped. Schema name is optional, if no schema
// is specified then dbo is assumed.
//
// removedColumnAnnotations:
// Custom annotations that exist on columns of the table that is being dropped.
// May be null or empty.
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
[SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void DropTable(string name, IDictionary<string, IDictionary<string, object>> removedColumnAnnotations, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to drop a table. Entity Framework Migrations APIs are
// not designed to accept input provided by untrusted sources (such as the end
// user of an application). If input is accepted from such sources it should
// be validated before being passed to these APIs to protect against SQL injection
// attacks etc.
//
// 参数:
// name:
// The name of the table to be dropped. Schema name is optional, if no schema
// is specified then dbo is assumed.
//
// removedAnnotations:
// Custom annotations that exist on the table that is being dropped. May be
// null or empty.
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void DropTable(string name, IDictionary<string, object> removedAnnotations, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to drop a table. Entity Framework Migrations APIs are
// not designed to accept input provided by untrusted sources (such as the end
// user of an application). If input is accepted from such sources it should
// be validated before being passed to these APIs to protect against SQL injection
// attacks etc.
//
// 参数:
// name:
// The name of the table to be dropped. Schema name is optional, if no schema
// is specified then dbo is assumed.
//
// removedAnnotations:
// Custom annotations that exist on the table that is being dropped. May be
// null or empty.
//
// removedColumnAnnotations:
// Custom annotations that exist on columns of the table that is being dropped.
// May be null or empty.
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
[SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void DropTable(string name, IDictionary<string, object> removedAnnotations, IDictionary<string, IDictionary<string, object>> removedColumnAnnotations, object anonymousArguments = null);
//
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals(object obj);
//
[EditorBrowsable(EditorBrowsableState.Never)]
public override int GetHashCode();
//
[EditorBrowsable(EditorBrowsableState.Never)]
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
public Type GetType();
//
[EditorBrowsable(EditorBrowsableState.Never)]
protected object MemberwiseClone();
//
// 摘要:
// Adds an operation to move a stored procedure to a new schema. Entity Framework
// Migrations APIs are not designed to accept input provided by untrusted sources
// (such as the end user of an application). If input is accepted from such
// sources it should be validated before being passed to these APIs to protect
// against SQL injection attacks etc.
//
// 参数:
// name:
// The name of the stored procedure to be moved. Schema name is optional, if
// no schema is specified then dbo is assumed.
//
// newSchema:
// The schema the stored procedure is to be moved to.
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void MoveStoredProcedure(string name, string newSchema, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to move a table to a new schema. Entity Framework Migrations
// APIs are not designed to accept input provided by untrusted sources (such
// as the end user of an application). If input is accepted from such sources
// it should be validated before being passed to these APIs to protect against
// SQL injection attacks etc.
//
// 参数:
// name:
// The name of the table to be moved. Schema name is optional, if no schema
// is specified then dbo is assumed.
//
// newSchema:
// The schema the table is to be moved to.
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void MoveTable(string name, string newSchema, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to rename a column. Entity Framework Migrations APIs are
// not designed to accept input provided by untrusted sources (such as the end
// user of an application). If input is accepted from such sources it should
// be validated before being passed to these APIs to protect against SQL injection
// attacks etc.
//
// 参数:
// table:
// The name of the table that contains the column to be renamed. Schema name
// is optional, if no schema is specified then dbo is assumed.
//
// name:
// The name of the column to be renamed.
//
// newName:
// The new name for the column.
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void RenameColumn(string table, string name, string newName, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to rename an index. Entity Framework Migrations APIs are
// not designed to accept input provided by untrusted sources (such as the end
// user of an application). If input is accepted from such sources it should
// be validated before being passed to these APIs to protect against SQL injection
// attacks etc.
//
// 参数:
// table:
// The name of the table that contains the index to be renamed. Schema name
// is optional, if no schema is specified then dbo is assumed.
//
// name:
// The name of the index to be renamed.
//
// newName:
// The new name for the index.
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void RenameIndex(string table, string name, string newName, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to rename a stored procedure. To change the schema of a
// stored procedure use MoveStoredProcedure Entity Framework Migrations APIs
// are not designed to accept input provided by untrusted sources (such as the
// end user of an application). If input is accepted from such sources it should
// be validated before being passed to these APIs to protect against SQL injection
// attacks etc.
//
// 参数:
// name:
// The name of the stored procedure to be renamed. Schema name is optional,
// if no schema is specified then dbo is assumed.
//
// newName:
// The new name for the stored procedure. Schema name is optional, if no schema
// is specified then dbo is assumed.
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void RenameStoredProcedure(string name, string newName, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to rename a table. To change the schema of a table use
// MoveTable. Entity Framework Migrations APIs are not designed to accept input
// provided by untrusted sources (such as the end user of an application). If
// input is accepted from such sources it should be validated before being passed
// to these APIs to protect against SQL injection attacks etc.
//
// 参数:
// name:
// The name of the table to be renamed. Schema name is optional, if no schema
// is specified then dbo is assumed.
//
// newName:
// The new name for the table. Schema name is optional, if no schema is specified
// then dbo is assumed.
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void RenameTable(string name, string newName, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to execute a SQL command or set of SQL commands. Entity
// Framework Migrations APIs are not designed to accept input provided by untrusted
// sources (such as the end user of an application). If input is accepted from
// such sources it should be validated before being passed to these APIs to
// protect against SQL injection attacks etc.
//
// 参数:
// sql:
// The SQL to be executed.
//
// suppressTransaction:
// A value indicating if the SQL should be executed outside of the transaction
// being used for the migration process. If no value is supplied the SQL will
// be executed within the transaction.
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames", MessageId = "0#")]
protected internal void Sql(string sql, bool suppressTransaction = false, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to execute a SQL file. Entity Framework Migrations APIs
// are not designed to accept input provided by untrusted sources (such as the
// end user of an application). If input is accepted from such sources it should
// be validated before being passed to these APIs to protect against SQL injection
// attacks etc.
//
// 参数:
// sqlFile:
// The SQL file to be executed. Relative paths are assumed to be relative to
// the current AppDomain's BaseDirectory.
//
// suppressTransaction:
// A value indicating if the SQL should be executed outside of the transaction
// being used for the migration process. If no value is supplied the SQL will
// be executed within the transaction.
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames", MessageId = "0#")]
protected internal void SqlFile(string sqlFile, bool suppressTransaction = false, object anonymousArguments = null);
//
// 摘要:
// Adds an operation to execute a SQL resource file. Entity Framework Migrations
// APIs are not designed to accept input provided by untrusted sources (such
// as the end user of an application). If input is accepted from such sources
// it should be validated before being passed to these APIs to protect against
// SQL injection attacks etc.
//
// 参数:
// sqlResource:
// The manifest resource name of the SQL resource file to be executed.
//
// resourceAssembly:
// The assembly containing the resource file. The calling assembly is assumed
// if not provided.
//
// suppressTransaction:
// A value indicating if the SQL should be executed outside of the transaction
// being used for the migration process. If no value is supplied the SQL will
// be executed within the transaction.
//
// anonymousArguments:
// Additional arguments that may be processed by providers. Use anonymous type
// syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames", MessageId = "0#")]
protected internal void SqlResource(string sqlResource, Assembly resourceAssembly = null, bool suppressTransaction = false, object anonymousArguments = null);
//
[EditorBrowsable(EditorBrowsableState.Never)]
public override string ToString();
//
// 摘要:
// Operations to be performed during the upgrade process.
public abstract void Up();
}
}
网友评论