dotnet / efcore

EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.
https://docs.microsoft.com/ef/
MIT License
13.63k stars 3.15k forks source link

Model validation for SqlServer identity/hilo or Sqlite auto-increment with default value #19772

Open roji opened 4 years ago

roji commented 4 years ago

Note that SqlServerMigrationsSqlGenerator silently drops the default value when adding identity columns - this is necessary because the differ adds a default value when adding non-nullable columns. So it seems prudent to raise validation exceptions if the user explicitly tries to configure a default on identity (and hilo) columns.

Probably relevant also for Sqlite.

ajcvickers commented 4 years ago

Related: #16814