SqlServerModelBuilderExtensions.UseIdentityColumns Method

Definition

Overloads

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

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.

C#
public static Microsoft.EntityFrameworkCore.ModelBuilder UseIdentityColumns (this Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder, int seed = 1, int increment = 1);
C#
public static Microsoft.EntityFrameworkCore.ModelBuilder UseIdentityColumns (this Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder, int seed, int increment = 1);

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

Entity Framework Core 9.0 and other versions
Product Versions
Entity Framework Core 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0

UseIdentityColumns(ModelBuilder, Int64, Int32)

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.

C#
public static Microsoft.EntityFrameworkCore.ModelBuilder UseIdentityColumns (this Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder, long seed = 1, int increment = 1);

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

Entity Framework Core 9.0 and other versions
Product Versions
Entity Framework Core 6.0, 7.0, 8.0, 9.0