C# 9 records as strongly-typed ids - Part 4: Entity Framework Core integration
So far in this series, I showed how to use C# 9 records to declare strongly-typed ids as easily as this:
public record ProductId(int Value) : StronglyTypedId<int>(Value); I also explained how to make them work correctly with ASP.NET Core model binding and JSON serialization.
Today, I’ll present another piece of the puzzle: how to make Entity Framework core handle strongly-typed ids correctly.
Value conversion for a specific strongly-typed id Out of the box, EF Core doesn’t know anything about our strongly-typed ids.