ValueObject should implement ToString similar to C# records
See original GitHub issueThe base ValueObject class should override ToString() and print its content, similar to how C# 9 records do it.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
C# 9 Records as DDD Value Objects
Here's how you could implement the same Address class as a value object: public class Address : ValueObject { public string Street {...
Read more >Implementing value objects
In terms of implementation, you can have a value object base class that has basic utility methods like equality based on the comparison...
Read more >DDD Value Objects as C# Records: The Missing Manual
C# Records are very handy if you need to implement Value Objects, because they offer support for value-equality out of the box.
Read more >Custom Equality check for C# 9 records
To conclude, I'm a bit puzzled, is restricting the override of equality methods of record objects an expected behaviour or is it because...
Read more >3 Different Ways to Implement Value Object in C# 10
Value objects are immutable variables predefined to be held in an entity and persist in a database. The number of passing it across...
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

Ah, yes, that would be great, but too much work / too high performance impact IMO.
I’d propose creating your custom ValueObject descendant and then overriding its
ToString()method to produce the serialized Json (or similar).