blog post image
Andrew Lock avatar

Andrew Lock

Series: Using strongly-typed entity IDs to avoid primitive obsession

In this series I look at using strongly-typed IDs to represent different types of entity ID. This is a form of primitive obsession—using strongly-typed IDs avoids a whole class of bugs by using the type system. I look at how to create types to represent the IDs and how to create converters so they interoperate easily with ASP.NET Core and EF Core.

Finally, I introduce the StronglyTypedId package, which reduces the amount of boilerplate you have to write manually, using Roslyn to automatically generate the IDs at build time.

Andrew Lock | .Net Escapades
Want an email when
there's new posts?