Searching simple object with a dictionary

My 2 cents.
If your simple objects are small enough and if your focus is on keeping it simple in the source code, an idea could be to store not the simple object, but its string representation, and convert back/forth simple object/string accordingly with json package functions in the data-access layer, so to minimize impact on existing codebase.
That would allow the exact match search.
That would slow down your data-access for sure, maybe some indexes can help but a match on a string field is never source of happiness.
A little step forward would be to calc an unique hash of the object (or its string repr), store that as a new field just to use it for the queries.

1 Like