I have a need to implement a special logical operations algorithm. The task has been assigned to store the logical conditions in a database and have C# code read the information and select the correct result.
Here is the scenario:
This company uses what they call a config code for all their products. The configuration code is typically 50 digits but in rare cases can be longer.
Based on certain digit values within the config code, I will need to select a specific software version.
Lets say Digits 5-7 in the config code must be ‘LLP’, AND digit 9 must be X OR Y. This would lead to a software version of v01.1.1. The logical operation would look something like this [(D5-7=’LLP’ && D9=’X’) || (D5-7=’LLP’ && D9=’Y’)], where D = The digit value in the configuration code.
The C# code must be able to read the Expression and determine the version code. I could write this in native C# code but the customer does not want to change the C# application every time there is a new version. The database itself would not be large, probably less than 100 records. How do I design and implement an algorithm that will read logical expressions stored in the database? I know how to select tables in a database, what I’m struggling with most is the evaluation expression.