MigrationBuilder.AddColumn Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
AddColumn<T>(String, String, String, Nullable<Boolean>, Nullable<Int32>, Boolean, String, Boolean, Object, String, String) |
Builds an AddColumnOperation to add a new column to a table. |
AddColumn<T>(String, String, String, Nullable<Boolean>, Nullable<Int32>, Boolean, String, Boolean, Object, String, String, Nullable<Boolean>) |
Builds an AddColumnOperation to add a new column to a table. |
AddColumn<T>(String, String, String, Nullable<Boolean>, Nullable<Int32>, Boolean, String, Boolean, Object, String, String, Nullable<Boolean>, String) |
Builds an AddColumnOperation to add a new column to a table. |
AddColumn<T>(String, String, String, Nullable<Boolean>, Nullable<Int32>, Boolean, String, Boolean, Object, String, String, Nullable<Boolean>, String, String, Nullable<Int32>, Nullable<Int32>, Nullable<Boolean>) |
Builds an AddColumnOperation to add a new column to a table. |
AddColumn<T>(String, String, String, Nullable<Boolean>, Nullable<Int32>, Boolean, String, Boolean, Object, String, String)
- Source:
- MigrationBuilder.cs
- Source:
- MigrationBuilder.cs
Builds an AddColumnOperation to add a new column to a table.
public virtual Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddColumnOperation> AddColumn<T> (string name, string table, string type = default, bool? unicode = default, int? maxLength = default, bool rowVersion = false, string schema = default, bool nullable = false, object defaultValue = default, string defaultValueSql = default, string computedColumnSql = default);
public virtual Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddColumnOperation> AddColumn<T> (string name, string table, string type, bool? unicode, int? maxLength, bool rowVersion, string schema, bool nullable, object defaultValue, string defaultValueSql, string computedColumnSql);
abstract member AddColumn : string * string * string * Nullable<bool> * Nullable<int> * bool * string * bool * obj * string * string -> Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddColumnOperation>
override this.AddColumn : string * string * string * Nullable<bool> * Nullable<int> * bool * string * bool * obj * string * string -> Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddColumnOperation>
Public Overridable Function AddColumn(Of T) (name As String, table As String, Optional type As String = Nothing, Optional unicode As Nullable(Of Boolean) = Nothing, Optional maxLength As Nullable(Of Integer) = Nothing, Optional rowVersion As Boolean = false, Optional schema As String = Nothing, Optional nullable As Boolean = false, Optional defaultValue As Object = Nothing, Optional defaultValueSql As String = Nothing, Optional computedColumnSql As String = Nothing) As OperationBuilder(Of AddColumnOperation)
Public Overridable Function AddColumn(Of T) (name As String, table As String, type As String, unicode As Nullable(Of Boolean), maxLength As Nullable(Of Integer), rowVersion As Boolean, schema As String, nullable As Boolean, defaultValue As Object, defaultValueSql As String, computedColumnSql As String) As OperationBuilder(Of AddColumnOperation)
Type Parameters
- T
The CLR type that the column is mapped to.
Parameters
- name
- String
The column name.
- table
- String
The name of the table that contains the column.
- type
- String
The store/database type of the column.
Indicates whether or not the column can contain Unicode data, or null
if not specified or not applicable.
The maximum length of data that can be stored in the column, or null
if not specified or not applicable.
- rowVersion
- Boolean
Indicates whether or not the column acts as an automatic concurrency token, such as a rowversion/timestamp column in SQL Server.
- schema
- String
The schema that contains the table, or null
if the default schema should be used.
- nullable
- Boolean
Indicates whether or not the column can store NULL
values.
- defaultValue
- Object
The default value for the column.
- defaultValueSql
- String
The SQL expression to use for the column's default constraint.
- computedColumnSql
- String
The SQL expression to use to compute the column value.
Returns
A builder to allow annotations to be added to the operation.
Applies to
AddColumn<T>(String, String, String, Nullable<Boolean>, Nullable<Int32>, Boolean, String, Boolean, Object, String, String, Nullable<Boolean>)
- Source:
- MigrationBuilder.cs
- Source:
- MigrationBuilder.cs
Builds an AddColumnOperation to add a new column to a table.
public virtual Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddColumnOperation> AddColumn<T> (string name, string table, string type = default, bool? unicode = default, int? maxLength = default, bool rowVersion = false, string schema = default, bool nullable = false, object defaultValue = default, string defaultValueSql = default, string computedColumnSql = default, bool? fixedLength = default);
abstract member AddColumn : string * string * string * Nullable<bool> * Nullable<int> * bool * string * bool * obj * string * string * Nullable<bool> -> Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddColumnOperation>
override this.AddColumn : string * string * string * Nullable<bool> * Nullable<int> * bool * string * bool * obj * string * string * Nullable<bool> -> Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddColumnOperation>
Public Overridable Function AddColumn(Of T) (name As String, table As String, Optional type As String = Nothing, Optional unicode As Nullable(Of Boolean) = Nothing, Optional maxLength As Nullable(Of Integer) = Nothing, Optional rowVersion As Boolean = false, Optional schema As String = Nothing, Optional nullable As Boolean = false, Optional defaultValue As Object = Nothing, Optional defaultValueSql As String = Nothing, Optional computedColumnSql As String = Nothing, Optional fixedLength As Nullable(Of Boolean) = Nothing) As OperationBuilder(Of AddColumnOperation)
Type Parameters
- T
The CLR type that the column is mapped to.
Parameters
- name
- String
The column name.
- table
- String
The name of the table that contains the column.
- type
- String
The store/database type of the column.
Indicates whether or not the column can contain Unicode data, or null
if not specified or not applicable.
The maximum length of data that can be stored in the column, or null
if not specified or not applicable.
- rowVersion
- Boolean
Indicates whether or not the column acts as an automatic concurrency token, such as a rowversion/timestamp column in SQL Server.
- schema
- String
The schema that contains the table, or null
if the default schema should be used.
- nullable
- Boolean
Indicates whether or not the column can store NULL
values.
- defaultValue
- Object
The default value for the column.
- defaultValueSql
- String
The SQL expression to use for the column's default constraint.
- computedColumnSql
- String
The SQL expression to use to compute the column value.
Indicates whether or not the column is constrained to fixed-length data.
Returns
A builder to allow annotations to be added to the operation.
Applies to
AddColumn<T>(String, String, String, Nullable<Boolean>, Nullable<Int32>, Boolean, String, Boolean, Object, String, String, Nullable<Boolean>, String)
- Source:
- MigrationBuilder.cs
- Source:
- MigrationBuilder.cs
Builds an AddColumnOperation to add a new column to a table.
public virtual Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddColumnOperation> AddColumn<T> (string name, string table, string type = default, bool? unicode = default, int? maxLength = default, bool rowVersion = false, string schema = default, bool nullable = false, object defaultValue = default, string defaultValueSql = default, string computedColumnSql = default, bool? fixedLength = default, string comment = default);
abstract member AddColumn : string * string * string * Nullable<bool> * Nullable<int> * bool * string * bool * obj * string * string * Nullable<bool> * string -> Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddColumnOperation>
override this.AddColumn : string * string * string * Nullable<bool> * Nullable<int> * bool * string * bool * obj * string * string * Nullable<bool> * string -> Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddColumnOperation>
Public Overridable Function AddColumn(Of T) (name As String, table As String, Optional type As String = Nothing, Optional unicode As Nullable(Of Boolean) = Nothing, Optional maxLength As Nullable(Of Integer) = Nothing, Optional rowVersion As Boolean = false, Optional schema As String = Nothing, Optional nullable As Boolean = false, Optional defaultValue As Object = Nothing, Optional defaultValueSql As String = Nothing, Optional computedColumnSql As String = Nothing, Optional fixedLength As Nullable(Of Boolean) = Nothing, Optional comment As String = Nothing) As OperationBuilder(Of AddColumnOperation)
Type Parameters
- T
The CLR type that the column is mapped to.
Parameters
- name
- String
The column name.
- table
- String
The name of the table that contains the column.
- type
- String
The store/database type of the column.
Indicates whether or not the column can contain Unicode data, or null
if not specified or not applicable.
The maximum length of data that can be stored in the column, or null
if not specified or not applicable.
- rowVersion
- Boolean
Indicates whether or not the column acts as an automatic concurrency token, such as a rowversion/timestamp column in SQL Server.
- schema
- String
The schema that contains the table, or null
if the default schema should be used.
- nullable
- Boolean
Indicates whether or not the column can store NULL
values.
- defaultValue
- Object
The default value for the column.
- defaultValueSql
- String
The SQL expression to use for the column's default constraint.
- computedColumnSql
- String
The SQL expression to use to compute the column value.
Indicates whether or not the column is constrained to fixed-length data.
- comment
- String
A comment to associate with the column.
Returns
A builder to allow annotations to be added to the operation.
Applies to
AddColumn<T>(String, String, String, Nullable<Boolean>, Nullable<Int32>, Boolean, String, Boolean, Object, String, String, Nullable<Boolean>, String, String, Nullable<Int32>, Nullable<Int32>, Nullable<Boolean>)
- Source:
- MigrationBuilder.cs
- Source:
- MigrationBuilder.cs
- Source:
- MigrationBuilder.cs
- Source:
- MigrationBuilder.cs
- Source:
- MigrationBuilder.cs
Builds an AddColumnOperation to add a new column to a table.
public virtual Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddColumnOperation> AddColumn<T> (string name, string table, string type = default, bool? unicode = default, int? maxLength = default, bool rowVersion = false, string schema = default, bool nullable = false, object defaultValue = default, string defaultValueSql = default, string computedColumnSql = default, bool? fixedLength = default, string comment = default, string collation = default, int? precision = default, int? scale = default, bool? stored = default);
public virtual Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddColumnOperation> AddColumn<T> (string name, string table, string? type = default, bool? unicode = default, int? maxLength = default, bool rowVersion = false, string? schema = default, bool nullable = false, object? defaultValue = default, string? defaultValueSql = default, string? computedColumnSql = default, bool? fixedLength = default, string? comment = default, string? collation = default, int? precision = default, int? scale = default, bool? stored = default);
abstract member AddColumn : string * string * string * Nullable<bool> * Nullable<int> * bool * string * bool * obj * string * string * Nullable<bool> * string * string * Nullable<int> * Nullable<int> * Nullable<bool> -> Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddColumnOperation>
override this.AddColumn : string * string * string * Nullable<bool> * Nullable<int> * bool * string * bool * obj * string * string * Nullable<bool> * string * string * Nullable<int> * Nullable<int> * Nullable<bool> -> Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddColumnOperation>
Public Overridable Function AddColumn(Of T) (name As String, table As String, Optional type As String = Nothing, Optional unicode As Nullable(Of Boolean) = Nothing, Optional maxLength As Nullable(Of Integer) = Nothing, Optional rowVersion As Boolean = false, Optional schema As String = Nothing, Optional nullable As Boolean = false, Optional defaultValue As Object = Nothing, Optional defaultValueSql As String = Nothing, Optional computedColumnSql As String = Nothing, Optional fixedLength As Nullable(Of Boolean) = Nothing, Optional comment As String = Nothing, Optional collation As String = Nothing, Optional precision As Nullable(Of Integer) = Nothing, Optional scale As Nullable(Of Integer) = Nothing, Optional stored As Nullable(Of Boolean) = Nothing) As OperationBuilder(Of AddColumnOperation)
Type Parameters
- T
The CLR type that the column is mapped to.
Parameters
- name
- String
The column name.
- table
- String
The name of the table that contains the column.
- type
- String
The store/database type of the column.
Indicates whether or not the column can contain Unicode data, or null
if not specified or not applicable.
The maximum length of data that can be stored in the column, or null
if not specified or not applicable.
- rowVersion
- Boolean
Indicates whether or not the column acts as an automatic concurrency token, such as a rowversion/timestamp column in SQL Server.
- schema
- String
The schema that contains the table, or null
if the default schema should be used.
- nullable
- Boolean
Indicates whether or not the column can store null
values.
- defaultValue
- Object
The default value for the column.
- defaultValueSql
- String
The SQL expression to use for the column's default constraint.
- computedColumnSql
- String
The SQL expression to use to compute the column value.
Indicates whether or not the column is constrained to fixed-length data.
- comment
- String
A comment to associate with the column.
- collation
- String
A collation to apply to the column.
The maximum number of digits that is allowed in this column, or null
if not specified or not applicable.
The maximum number of decimal places that is allowed in this column, or null
if not specified or not applicable.
Returns
A builder to allow annotations to be added to the operation.
Remarks
See Database migrations for more information and examples.
Applies to
Entity Framework