User built queries on objects

I'm looking at an old app that allows users to build queries to retrieve objects in a list that match that query. It is only querying off a single property on the objects: a Dictionary<string, string> . Each object's dictionary property will always have the same keys. In the current code, it is a massive mess of nested if/else statements. The flow goes like this: 1. User selects key from the dictionary's keys 2. User selects operator (greater than, less than, equals, IN, contains, etc.) (there is an if/else statement for each of these) 3. User enters a single value 4. User can then decide to AND or OR it with another query, where the process repeats (if/else every time an AND / OR is seen) What is a better way to structure all this? Is there a specific pattern I can use?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server