Marvin-Brouwer / FluentSerializer

A fluent take on serializer libraries
Apache License 2.0
20 stars 1 forks source link

Improvement of `IDataNode.GetHashCode()` #206

Closed Marvin-Brouwer closed 1 year ago

Marvin-Brouwer commented 1 year ago

Is your feature request related to a problem? Please describe. The current implementation of the DataNodeComparer requires an implementer to override the object.GetHashCode() method. This is hidden complexity.

Describe the solution you'd like Make IDataNode have a GetNodeHash() method so it HAS to be implemented. Than create a default implementation on the IDataNodes GetHashCode() that points to GetNodeHash() for consistency. And finally make the DataNodeComparer use IDataNode.GetNodeHash() where it uses the IDataNode.GetHashCode() currently.

Describe alternatives you've considered Maybe create an analyzer that warns if it's not overriden?

Additional context -

Marvin-Brouwer commented 1 year ago

In addition, the converters shouldn't use the hashcode for determining if they're unique. This should just be a GUID, maybe the guid of the type could be enought for DateTimeConversion for example but otherwise just create a guid

Marvin-Brouwer commented 1 year ago