I have to import data from Excel to an SQL database. The Excel data contains various parameters and their values, like P1, P1, P4, P5, etc. I have to apply business rules. Like if (P1 > 100 and P1 < 200) then insert the record in database. Similarly, in some cases, string values are also validated. Can I have any open source rule engine that contains UI to change, add, and delete the rules? I am using C# to read the Excel data and and inserting the records.
One more thing, which of the following is the best approach?
-
Read Excel data first and store every record as an object in a collection, iterate through the collection, apply business rules on every object and insert record in the database. Or
-
Read one record from Excel, apply business rules and insert the record in the database. Repeat the process for the whole Excel spreadsheet.
3
You may look for different simple rule engines in .NET. However, in the case if you’re using .NET 3.0 or later, you can use the Rules Engine of Windows Workflow Foundation without using actually Workflow.
We have done this in our project, and you are free to use SQL or XML as the back-end, and it works pretty good. You can use the IDE that comes with the Workflow examples and use that in your own application.
You may also consider the following options:
- Open Source Rule Engines in C#
- Simple Rule Engine from SourceForge site