Skip to main content
Use HiLo to generate keys with Entity Framework Core

Use HiLo to generate keys with Entity Framework Core

Entity Framework Core supports different key generation strategies like identity, Sequence and HiLo. In my previous post, I talked about using SQL Server Sequence with EF Core to Create Primary Key. Database sequences are cached, scalable and address concurrency issues. But there would be a database round-trip for every new the sequence value. And in case of high number of inserts this becomes a little heavy. But you can optimize the sequence with HiLo pattern. And EF Core supports “HiLo” out of the box. So in this post, we will see how to use HiLo to generate keys with Entity Framework Core. Read More

Use SQL Server Sequence in Entity Framework Core to Create Primary Key

Use SQL Server Sequence in Entity Framework Core to Create Primary Key

Entity Framework doesn’t support Sequence out of the box. However, there are ways to use it. But the good news is, Entity Framework Core supports Sequence out of the box. I also mentioned in my earlier post Quick summary of what’s new in Entity Framework Core 1.0. So in this post, let’s find out how to use SQL Server Sequence in Entity Framework Core to create primary key.
Read More