I have requirement to build new rule engine in which i have rule like this which is stored in Excel sheet, in tabular format.
<If> 'Name = Nita ' <Value> '200' <else> 'Name = Gita' <value> '300' <LookInto> '/Name/@Income'
I have two files say 1 n 2. i need to see in first file that whether Name is Nita or Gita. Based on execution i will get value. Now this result value i need to compare with second file , which is a xml file and whose path has been defined into .
can anybody suggest me that is there anything in C# that i can use effectively to develop the same,, or can anybody suggest me how i can achieve this with C#.. i need some idea for class design of the same.
I am using .Net 1.1.
Firstly, you need to create classes that can define your rules. Once you have this structure in place, you will be able to build an engine that utilises those classes.
I would look at creating something like:
Then go on from there….
This structure would be better if it was changed to have a group of rules that could be added to a group of rules, for example (a AND b) OR (c AND d) – I’ll leave this to you to think about for now.
Please note I’m using some C# 3.0 constructs here, you will need to create full private properties in 1.1.