Share via


MigrationBuilder.CreateTable Method

Definition

Overloads

CreateTable<TColumns>(String, Func<ColumnsBuilder,TColumns>, String, Action<CreateTableBuilder<TColumns>>)

Builds an CreateTableOperation to create a new table.

CreateTable<TColumns>(String, Func<ColumnsBuilder,TColumns>, String, Action<CreateTableBuilder<TColumns>>, String)

Builds a CreateTableOperation to create a new table.

CreateTable<TColumns>(String, Func<ColumnsBuilder,TColumns>, String, Action<CreateTableBuilder<TColumns>>)

Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs

Builds an CreateTableOperation to create a new table.

public virtual Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.CreateTableBuilder<TColumns> CreateTable<TColumns> (string name, Func<Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.ColumnsBuilder,TColumns> columns, string schema = default, Action<Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.CreateTableBuilder<TColumns>> constraints = default);
abstract member CreateTable : string * Func<Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.ColumnsBuilder, 'Columns> * string * Action<Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.CreateTableBuilder<'Columns>> -> Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.CreateTableBuilder<'Columns>
override this.CreateTable : string * Func<Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.ColumnsBuilder, 'Columns> * string * Action<Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.CreateTableBuilder<'Columns>> -> Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.CreateTableBuilder<'Columns>
Public Overridable Function CreateTable(Of TColumns) (name As String, columns As Func(Of ColumnsBuilder, TColumns), Optional schema As String = Nothing, Optional constraints As Action(Of CreateTableBuilder(Of TColumns)) = Nothing) As CreateTableBuilder(Of TColumns)

Type Parameters

TColumns

Type of a typically anonymous type for building columns.

Parameters

name
String

The name of the table.

columns
Func<ColumnsBuilder,TColumns>

A delegate using a ColumnsBuilder to create an anonymous type configuring the columns of the table.

schema
String

The schema that contains the table, or null to use the default schema.

constraints
Action<CreateTableBuilder<TColumns>>

A delegate allowing constraints to be applied over the columns configured by the 'columns' delegate above.

Returns

A CreateTableBuilder<TColumns> to allow further configuration to be chained.

Applies to

CreateTable<TColumns>(String, Func<ColumnsBuilder,TColumns>, String, Action<CreateTableBuilder<TColumns>>, String)

Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs

Builds a CreateTableOperation to create a new table.

public virtual Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.CreateTableBuilder<TColumns> CreateTable<TColumns> (string name, Func<Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.ColumnsBuilder,TColumns> columns, string schema = default, Action<Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.CreateTableBuilder<TColumns>> constraints = default, string comment = default);
public virtual Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.CreateTableBuilder<TColumns> CreateTable<TColumns> (string name, Func<Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.ColumnsBuilder,TColumns> columns, string? schema = default, Action<Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.CreateTableBuilder<TColumns>>? constraints = default, string? comment = default);
abstract member CreateTable : string * Func<Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.ColumnsBuilder, 'Columns> * string * Action<Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.CreateTableBuilder<'Columns>> * string -> Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.CreateTableBuilder<'Columns>
override this.CreateTable : string * Func<Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.ColumnsBuilder, 'Columns> * string * Action<Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.CreateTableBuilder<'Columns>> * string -> Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.CreateTableBuilder<'Columns>
Public Overridable Function CreateTable(Of TColumns) (name As String, columns As Func(Of ColumnsBuilder, TColumns), Optional schema As String = Nothing, Optional constraints As Action(Of CreateTableBuilder(Of TColumns)) = Nothing, Optional comment As String = Nothing) As CreateTableBuilder(Of TColumns)

Type Parameters

TColumns

Type of a typically anonymous type for building columns.

Parameters

name
String

The name of the table.

columns
Func<ColumnsBuilder,TColumns>

A delegate using a ColumnsBuilder to create an anonymous type configuring the columns of the table.

schema
String

The schema that contains the table, or null to use the default schema.

constraints
Action<CreateTableBuilder<TColumns>>

A delegate allowing constraints to be applied over the columns configured by the 'columns' delegate above.

comment
String

A comment to be applied to the table.

Returns

A CreateTableBuilder<TColumns> to allow further configuration to be chained.

Remarks

See Database migrations for more information and examples.

Applies to