Value Generators in EF Core
Introduction EF Core has the concept of value generators. Very simply, they provide values for properties, either the primary key or another one. Wasn't too long ago that this feature - configurable value generators - was missing from EF Core, but now we have it, and it works well. We still don't have all of the id generators offered by NHibernate , but, we have something, and, what's best, we can build our own! Strategies versus Value Generators Before value generators were around, we could specify a generation or update strategy for properties, like the id. Strategies were a hint for the database provider, they didn't exactly specify how the value would be generated. The strategies are: None : the value is never generated Identity : the value is generated only when the record is first inserted Computed : the value is generated when the row is either inserted or modified Usually, Identity meant that something like auto-increment or SQL Server IDENTITY will be used, ...