ardalis / pluralsight-ddd-fundamentals

Sample code for the Pluralsight DDD Fundamentals course by Julie Lerman and Steve "ardalis" Smith

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ValueObject to Implement IEquatable<ValueObject>

Reapism opened this issue · comments

In an old implementation of ValueObject used in the clean architecture solution, it was using reflection but also implementing IEquatable<ValueObject>

This new, improved version has since been updated using IComparable, IComparable<ValueObject>

Is there a reason why IEquatable was removed from ValueObject? It doesn't seem necessary as the base object Equals method suffices, but I was wondering if I adding it in my project would yield any sort of "PROs" if you will.

Not that I'm aware of, no. It was deemed unnecessary. There are many implementations of the value object pattern in .NET, and I'm trying to keep up with the ones that provide the best features while being simplest to implement. I expect in the near future I'll be using record types (with some modification), as they're closer to the design intent of value objects.