Sorry if this is a little abstract. I'm in the early stages of development.
I have two object types:
- An object that needs to store a series of user defined conditions.
- An object that matches zero or more of the conditions defined in the first object.
Here's a simple example of how it would run.
- A user creates several objects of type 2 and adds them to a collection.
- Then the user creates an object of type 1 and assigns several conditions to it.
- The system uses the conditions in object type 1 to generate a list of objects of type 2 sorted by what percentage of the conditions each object matches.
Here is a sample of the expected output:
Conditions List
Quantity >= 2 Object5 100%
Value < 2 Object2 75%
Category = "Blah" Object4 50%
Quality > 5 Object1 25%
Object3 0%
The first operand in each condition is the name of a property while the second operand is the value of that property.
How can I accomplish this?
My first thought is that it looks similar to a query language. If they were records in a DB table I could stitch together an SQL string for each condition, run each query and count the number of times each record id showed up in the query results. But these are plain old C# objects. I haven't decided on what to use for object persistence yet so I'd rather not tie myself to a db engine at this point. Any suggestions?