Making ValueObject.GetEqualityComponents return IComparable is a breaking change
See original GitHub issuePreviously GetEqualityComponents() returned IEnumerable<object>. Now it returns IEnumerable<IComparable>. If the ValueObject holds an Entity and it is used as an Equality Component it causes a compile time error if the Entity doesn’t implement IComparable.
What is the appropriate fix here? Every type that ValueObject uses as an Equality Component must now implement IComparable? Could this extend to the CSharpFunctionalExtensions Entity type so entities have it is available out-of-the-box?
Issue Analytics
- State:
- Created 3 months ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
IComparable<ValueObject> is Potentially Breaking due to ...
The tests then fail when calling the Be() method from FluentAssertions, because it checks that the comparison returns 0, but my ValueObjects ......
Read more >Value Object: a better implementation
This post is about a better implementation of Value Object. ... var valueObject = (ValueObject)obj; return GetEqualityComponents().
Read more >CA1036: Override methods on comparable types
A type implements the System.IComparable interface and does not override System.Object.Equals or does not overload the language-specific ...
Read more >micro-elements - MicroElements.Functional 1.0.0-beta.4
To implement ValueObject you need: implement Object.Equals; implement Object.GetHashCode; implement Equality operator; implement Inequality operator; implement ...
Read more >Microservices Architecture for Containerized NET Applications
It discusses architectural design and implementation approaches using .NET and. Docker containers. To make it easier to get started, the guide focuses on...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Yes, that’s a good idea. No particular reason why it’s not done yet. Appreciate if you could submit a PR.
Hi, this is also a breaking change for any kind of list or array ValueObjects. The following Examples aren’t possible any more:
Value Object as an byte array
Value Object as a List of ValueObjects
Do you have any suggestions how to solve such scenarios?