Thomas Levesque 10/30/2020

Using C# 9 records as strongly-typed ids

Read Original

This technical article discusses the problem of using primitive types like integers for entity IDs, which can lead to bugs when IDs are accidentally swapped. It introduces the concept of strongly-typed IDs as a solution and demonstrates how to implement them. The article focuses on using the new C# 9 record types to create concise, immutable, and value-semantic ID types with minimal boilerplate code, comparing this approach to traditional manual implementations.

Using C# 9 records as strongly-typed ids

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser