I have an interface
ICondition which only defines a single method,
This works well as it is the only information the parent entity needs from its conditions.
However, there is a situation where a user needs to remove a specific condition from its parent that I am struggling to find a elegant way to implement.
Both classes that implement this interface happen to use a GUID identifier at the moment, but there's no inherent reason why this would need to be the case and could be subject to change; the two classes don't really have anything in common other than being predicates.
One possible solution could be to override the
Equals method in the classes and return true when passed the ID. However, to me, this seems to not quite mesh with the intent of the method and violates the principal of least astonishment.
Another solution could be to create an
IIdentifiable interface with a method,
IdentifiesAs then have
ICondition inherit from it. This however seems like it goes against the ISP spirt as any implementor of
ICondition must now implement
Does anyone have any guidance for sticking to the ISP while being able to uniquely identify a object? Am I overthinking this?