-
Notifications
You must be signed in to change notification settings - Fork 91
[Proposal] Consider optional support for class vs. struct #46
Description
Hi Andrew. In your excellent series of blog posts on Strongly Typed Id's, you make mention of some downsides to using a struct to model identity versus a class, due to implicit parameterless constructors. You also cite Vladamir Khorikov's article on the subject who makes further arguments for not choosing a struct for modelling identity and favoring a class. Classes have their downsides too of course, not least of which is having to null-check them all over the place, so they're not a panacea, but if you're trying to follow DDD best practices where protection of invariants is paramount, a class-based option would be desirable.
So, with all that said, have you considered enabling class-based strongly typed identifiers in your library in addition to struct-based ones?