Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

SqlServerModelBuilderExtensions.UseIdentityColumns Method

Definition

Namespace:
Microsoft.EntityFrameworkCore
Assembly:
Microsoft.EntityFrameworkCore.SqlServer.dll
Package:
Microsoft.EntityFrameworkCore.SqlServer v10.0.0
Package:
Microsoft.EntityFrameworkCore.SqlServer v3.0.0
Package:
Microsoft.EntityFrameworkCore.SqlServer v3.1.0
Package:
Microsoft.EntityFrameworkCore.SqlServer v5.0.0
Package:
Microsoft.EntityFrameworkCore.SqlServer v6.0.0
Package:
Microsoft.EntityFrameworkCore.SqlServer v7.0.0
Package:
Microsoft.EntityFrameworkCore.SqlServer v8.0.0
Package:
Microsoft.EntityFrameworkCore.SqlServer v9.0.0

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

Name Description
UseIdentityColumns(ModelBuilder, Int32, Int32)

Configures the model to use the SQL Server IDENTITY feature to generate values for key properties marked as OnAdd, when targeting SQL Server. This is the default behavior when targeting SQL Server.

UseIdentityColumns(ModelBuilder, Int64, Int32)

Configures the model to use the SQL Server IDENTITY feature to generate values for key properties marked as OnAdd, when targeting SQL Server. This is the default behavior when targeting SQL Server.

UseIdentityColumns(ModelBuilder, Int32, Int32)

Source:
SqlServerModelBuilderExtensions.cs
Source:
SqlServerModelBuilderExtensions.cs
Source:
SqlServerModelBuilderExtensions.cs
Source:
SqlServerModelBuilderExtensions.cs
Source:
SqlServerModelBuilderExtensions.cs
Source:
SqlServerModelBuilderExtensions.cs
Source:
SqlServerModelBuilderExtensions.cs
Source:
SqlServerModelBuilderExtensions.cs

Configures the model to use the SQL Server IDENTITY feature to generate values for key properties marked as OnAdd, when targeting SQL Server. This is the default behavior when targeting SQL Server.

public static Microsoft.EntityFrameworkCore.ModelBuilder UseIdentityColumns(this Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder, int seed, int increment = 1);
public static Microsoft.EntityFrameworkCore.ModelBuilder UseIdentityColumns(this Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder, int seed = 1, int increment = 1);
static member UseIdentityColumns : Microsoft.EntityFrameworkCore.ModelBuilder * int * int -> Microsoft.EntityFrameworkCore.ModelBuilder
<Extension()>
Public Function UseIdentityColumns (modelBuilder As ModelBuilder, seed As Integer, Optional increment As Integer = 1) As ModelBuilder
<Extension()>
Public Function UseIdentityColumns (modelBuilder As ModelBuilder, Optional seed As Integer = 1, Optional increment As Integer = 1) As ModelBuilder

Parameters

modelBuilder
ModelBuilder

The model builder.

seed
Int32

The value that is used for the very first row loaded into the table.

increment
Int32

The incremental value that is added to the identity value of the previous row that was loaded.

Returns

The same builder instance so that multiple calls can be chained.

Remarks

See Modeling entity types and relationships, and Accessing SQL Server and Azure SQL databases with EF Core for more information and examples.

Applies to

UseIdentityColumns(ModelBuilder, Int64, Int32)

Source:
SqlServerModelBuilderExtensions.cs
Source:
SqlServerModelBuilderExtensions.cs
Source:
SqlServerModelBuilderExtensions.cs
Source:
SqlServerModelBuilderExtensions.cs
Source:
SqlServerModelBuilderExtensions.cs

Configures the model to use the SQL Server IDENTITY feature to generate values for key properties marked as OnAdd, when targeting SQL Server. This is the default behavior when targeting SQL Server.

public static Microsoft.EntityFrameworkCore.ModelBuilder UseIdentityColumns(this Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder, long seed = 1, int increment = 1);
static member UseIdentityColumns : Microsoft.EntityFrameworkCore.ModelBuilder * int64 * int -> Microsoft.EntityFrameworkCore.ModelBuilder
<Extension()>
Public Function UseIdentityColumns (modelBuilder As ModelBuilder, Optional seed As Long = 1, Optional increment As Integer = 1) As ModelBuilder

Parameters

modelBuilder
ModelBuilder

The model builder.

seed
Int64

The value that is used for the very first row loaded into the table.

increment
Int32

The incremental value that is added to the identity value of the previous row that was loaded.

Returns

The same builder instance so that multiple calls can be chained.

Remarks

See Modeling entity types and relationships, and Accessing SQL Server and Azure SQL databases with EF Core for more information and examples.

Applies to


Feedback

Was this page helpful?