C# base Id class with static convenience methods
Goal
Recently I read Vaughn Vernon’s Implementing Domain-Driven Design book, in it he uses specific classes for identifiers instead of using basic types for example Guid
or String
.
It is good because the code will be more readable using for example ProductId
and CustomerId
types and it help avoiding mistakes of using e.g. product id instead of customer id as method parameter, because the compiler will complain.