MigrationBuilder.AddColumn 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
AddColumn<T>(String, String, String, Nullable<Boolean>, Nullable<Int32>, Boolean, String, Boolean, Object, String, String)
- Source:
- MigrationBuilder.cs
- Source:
- MigrationBuilder.cs
生成 以 AddColumnOperation 向表添加新列。
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)
类型参数
- T
列映射到的 CLR 类型。
参数
- name
- String
列名称。
- table
- String
包含该列的表的名称。
- type
- String
列的存储/数据库类型。
- rowVersion
- Boolean
指示列是否充当自动并发标记,例如SQL Server中的 rowversion/timestamp 列。
- schema
- String
包含表的架构,或者 null
是否应使用默认架构。
- nullable
- Boolean
指示列是否可以存储 NULL
值。
- defaultValue
- Object
列的默认值。
- defaultValueSql
- String
要用于列的默认约束的 SQL 表达式。
- computedColumnSql
- String
用于计算列值的 SQL 表达式。
返回
一个生成器,允许将批注添加到操作中。
适用于
AddColumn<T>(String, String, String, Nullable<Boolean>, Nullable<Int32>, Boolean, String, Boolean, Object, String, String, Nullable<Boolean>)
- Source:
- MigrationBuilder.cs
- Source:
- MigrationBuilder.cs
生成 以 AddColumnOperation 向表添加新列。
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)
类型参数
- T
列映射到的 CLR 类型。
参数
- name
- String
列名称。
- table
- String
包含该列的表的名称。
- type
- String
列的存储/数据库类型。
- rowVersion
- Boolean
指示列是否充当自动并发标记,例如SQL Server中的 rowversion/timestamp 列。
- schema
- String
包含表的架构,或者 null
是否应使用默认架构。
- nullable
- Boolean
指示列是否可以存储 NULL
值。
- defaultValue
- Object
列的默认值。
- defaultValueSql
- String
要用于列的默认约束的 SQL 表达式。
- computedColumnSql
- String
用于计算列值的 SQL 表达式。
返回
一个生成器,允许将批注添加到操作中。
适用于
AddColumn<T>(String, String, String, Nullable<Boolean>, Nullable<Int32>, Boolean, String, Boolean, Object, String, String, Nullable<Boolean>, String)
- Source:
- MigrationBuilder.cs
- Source:
- MigrationBuilder.cs
生成 以 AddColumnOperation 向表添加新列。
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)
类型参数
- T
列映射到的 CLR 类型。
参数
- name
- String
列名称。
- table
- String
包含该列的表的名称。
- type
- String
列的存储/数据库类型。
- rowVersion
- Boolean
指示列是否充当自动并发标记,例如SQL Server中的 rowversion/timestamp 列。
- schema
- String
包含表的架构,或者 null
是否应使用默认架构。
- nullable
- Boolean
指示列是否可以存储 NULL
值。
- defaultValue
- Object
列的默认值。
- defaultValueSql
- String
要用于列的默认约束的 SQL 表达式。
- computedColumnSql
- String
用于计算列值的 SQL 表达式。
- comment
- String
要与列关联的注释。
返回
一个生成器,允许将批注添加到操作中。
适用于
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
生成 以 AddColumnOperation 向表添加新列。
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)
类型参数
- T
列映射到的 CLR 类型。
参数
- name
- String
列名称。
- table
- String
包含该列的表的名称。
- type
- String
列的存储/数据库类型。
- rowVersion
- Boolean
指示列是否充当自动并发标记,例如SQL Server中的 rowversion/timestamp 列。
- schema
- String
包含表的架构,或者 null
是否应使用默认架构。
- nullable
- Boolean
指示列是否可以存储 null
值。
- defaultValue
- Object
列的默认值。
- defaultValueSql
- String
要用于列的默认约束的 SQL 表达式。
- computedColumnSql
- String
用于计算列值的 SQL 表达式。
- comment
- String
要与列关联的注释。
- collation
- String
要应用于列的排序规则。
返回
一个生成器,允许将批注添加到操作中。
注解
有关详细信息和示例 ,请参阅数据库迁移 。