Class CreateTableBuilder<TColumns>
- Assembly
- Microsoft.EntityFrameworkCore.Relational.dll
A builder for CreateTableOperation operations.
public class CreateTableBuilder<TColumns> : OperationBuilder<CreateTableOperation>, IInfrastructure<CreateTableOperation>
Type Parameters
TColumnsType of a typically anonymous type for building columns.
- Inheritance
-
CreateTableBuilder<TColumns>
- Implements
-
IInfrastructure<CreateTableOperation>
- Inherited Members
Constructors
CreateTableBuilder(CreateTableOperation, IReadOnlyDictionary<PropertyInfo, AddColumnOperation>)
Constructs a new builder for the given CreateTableOperation and with the given map of AddColumnOperation operations for columns.
public CreateTableBuilder(CreateTableOperation operation, IReadOnlyDictionary<PropertyInfo, AddColumnOperation> columnMap)
Parameters
operationCreateTableOperationThe CreateTableOperation.
columnMapIReadOnlyDictionary<PropertyInfo, AddColumnOperation>The map of CLR properties to AddColumnOperations.
Methods
Annotation(string, object)
Annotates the operation with the given name/value pair.
public virtual CreateTableBuilder<TColumns> Annotation(string name, object value)
Parameters
Returns
- CreateTableBuilder<TColumns>
The same builder so that multiple calls can be chained.
CheckConstraint(string, string)
Configures a check constraint on the table.
public virtual OperationBuilder<AddCheckConstraintOperation> CheckConstraint(string name, string sql)
Parameters
Returns
- OperationBuilder<AddCheckConstraintOperation>
The same builder so that multiple calls can be chained.
ForeignKey(string, Expression<Func<TColumns, object>>, string, string, string, ReferentialAction, ReferentialAction)
Configures a single-column foreign key on the table.
public virtual OperationBuilder<AddForeignKeyOperation> ForeignKey(string name, Expression<Func<TColumns, object>> column, string principalTable, string principalColumn, string principalSchema = null, ReferentialAction onUpdate = ReferentialAction.NoAction, ReferentialAction onDelete = ReferentialAction.NoAction)
Parameters
namestringThe foreign key constraint name.
columnExpression<Func<TColumns, object>>The column used for the foreign key.
principalTablestringThe table to which the foreign key is constrained.
principalColumnstringThe column to which the foreign key column is constrained.
principalSchemastringThe schema that contains the table to which the foreign key is constrained.
onUpdateReferentialActionThe ReferentialAction to use for updates.
onDeleteReferentialActionThe ReferentialAction to use for deletes.
Returns
- OperationBuilder<AddForeignKeyOperation>
The same builder so that multiple calls can be chained.
ForeignKey(string, Expression<Func<TColumns, object>>, string, string[], string, ReferentialAction, ReferentialAction)
Configures a multiple-column (composite) foreign key on the table.
public virtual OperationBuilder<AddForeignKeyOperation> ForeignKey(string name, Expression<Func<TColumns, object>> columns, string principalTable, string[] principalColumns, string principalSchema = null, ReferentialAction onUpdate = ReferentialAction.NoAction, ReferentialAction onDelete = ReferentialAction.NoAction)
Parameters
namestringThe foreign key constraint name.
columnsExpression<Func<TColumns, object>>The columns used for the foreign key.
principalTablestringThe table to which the foreign key is constrained.
principalColumnsstring[]The columns to which the foreign key column is constrained.
principalSchemastringThe schema that contains the table to which the foreign key is constrained.
onUpdateReferentialActionThe ReferentialAction to use for updates.
onDeleteReferentialActionThe ReferentialAction to use for deletes.
Returns
- OperationBuilder<AddForeignKeyOperation>
The same builder so that multiple calls can be chained.
PrimaryKey(string, Expression<Func<TColumns, object>>)
Configures a primary key on the table.
public virtual OperationBuilder<AddPrimaryKeyOperation> PrimaryKey(string name, Expression<Func<TColumns, object>> columns)
Parameters
namestringThe primary key constraint name.
columnsExpression<Func<TColumns, object>>The columns that make up the primary key.
Returns
- OperationBuilder<AddPrimaryKeyOperation>
The same builder so that multiple calls can be chained.
UniqueConstraint(string, Expression<Func<TColumns, object>>)
Configures a unique constraint on the table.
public virtual OperationBuilder<AddUniqueConstraintOperation> UniqueConstraint(string name, Expression<Func<TColumns, object>> columns)
Parameters
namestringThe constraint name.
columnsExpression<Func<TColumns, object>>The columns that make up the constraint.
Returns
- OperationBuilder<AddUniqueConstraintOperation>
The same builder so that multiple calls can be chained.