Table of Contents

Class ColumnsBuilder

Namespace
Microsoft.EntityFrameworkCore.Migrations.Operations.Builders
Assembly
Microsoft.EntityFrameworkCore.Relational.dll

A builder for ColumnOperation operations.

public class ColumnsBuilder
Inheritance
ColumnsBuilder
Inherited Members

Constructors

ColumnsBuilder(CreateTableOperation)

Constructs a builder for the given CreateTableOperation.

public ColumnsBuilder(CreateTableOperation createTableOperation)

Parameters

createTableOperation CreateTableOperation

The operation.

Methods

Column<T>(string, bool?, int?, bool, string, bool, object, string, string, bool?, string, string, int?, int?, bool?)

Adds a AddColumnOperation to the CreateTableOperation.

Note that for nullable parameters a null value means not-specified.

public virtual OperationBuilder<AddColumnOperation> Column<T>(string type = null, bool? unicode = null, int? maxLength = null, bool rowVersion = false, string name = null, bool nullable = false, object defaultValue = null, string defaultValueSql = null, string computedColumnSql = null, bool? fixedLength = null, string comment = null, string collation = null, int? precision = null, int? scale = null, bool? stored = null)

Parameters

type string

The database type of the column.

unicode bool?

Indicates whether or not the column will store Unicode data.

maxLength int?

The maximum length for data in the column.

rowVersion bool

Indicates whether or not the column will act as a rowversion/timestamp concurrency token.

name string

The column name.

nullable bool

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.

fixedLength bool?

Indicates whether or not the column is constrained to fixed-length data.

comment string

A comment to be applied to the column.

collation string

A collation to be applied to the column.

precision int?

The maximum number of digits for data in the column.

scale int?

The maximum number of decimal places for data in the column.

stored bool?

Whether the value of the computed column is stored in the database or not.

Returns

OperationBuilder<AddColumnOperation>

The same builder so that multiple calls can be chained.

Type Parameters

T

The CLR type of the column.