efcore icon indicating copy to clipboard operation
efcore copied to clipboard

Identity property configuration

Open vorenus181 opened this issue 8 years ago • 2 comments

There is no way to configure initial value of identity column. EF should allow to add additional property configuration to produce sql like this:

CREATE TABLE exmaple ( Id int IDENTITY(1000, 1) ...

Further technical details

EF Core version: 2.1 preview 2 Database Provider: Microsoft.EntityFrameworkCore.SqlServer Operating system: Windows 10 Home IDE: Visual Studio 2017 15.6.3

vorenus181 avatar May 07 '18 04:05 vorenus181

Note that there are a couple of parts to this:

  • Update of the Migrations API to allow Identity configuration to be specified without dropping down to raw SQL. This is likely a relatively small change.
  • Add a SQL Server-specific extension method to specify this configuration such that:
    • It aligns with the conventions and specifications for Identity columns
    • It flows through to Migrations such that the API covered in the first point is used when a new migration is scaffolded.

ajcvickers avatar May 07 '18 19:05 ajcvickers

@ajcvickers I've raised a PR to add the support for it. I've only covered the basic scenario of specifying the seed and increment in UseSqlServerIdentityColumn call.

If I understand your details above, I'm missing the scaffolding support for these two parameters on migrations. Any pointers on where to look for that, and what that would look like?

Muppets avatar Feb 16 '19 11:02 Muppets