DbMigration.AddColumn Method (String, String, Func<ColumnBuilder, ColumnModel>, Object)

 

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.

Namespace:   System.Data.Entity.Migrations
Assembly:  EntityFramework (in EntityFramework.dll)

[SuppressMessageAttribute("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected internal void AddColumn(
	string table,
	string name,
	Func<ColumnBuilder, ColumnModel> columnAction,
	object anonymousArguments = null
)

Parameters

table
Type: System.String

The name of the table to add the column to. Schema name is optional, if no schema is specified then dbo is assumed.

name
Type: System.String

The name of the column to be added.

columnAction
Type: System.Func<ColumnBuilder, ColumnModel>

An action that specifies the column to be added. i.e. c =&gt; c.Int(nullable: false, defaultValue: 3)

anonymousArguments
Type: System.Object

The additional arguments that may be processed by providers. Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'.