scripting - How to allow users to define financial formulas in a C# app -


I need to be able to define the sources of my users who will calculate the values ​​based on the data. For example

  // example Return to GetMonetaryAmountFromDatabase ("Due") * 1.2; // Example 2 Return GetMonetaryAmountFromDatabase ("Due amount") * GetFactorFromDatabase ("Discount");  

I will also require / * + - operation to provide local એરબેલ્સ and execute IF statements, such as

  var amountDue = GetMonetaryAmountFromDatabase (" Amount due"); If (amount amount> 100000) return amount fixed * 0.75; If (amount of> 50000) return amount fixed * 0.9; Because of the withdrawal amount;  

The scenario is complex because I have the following structure.

  1. Customers (some hundred)
  2. Configuration (Approx. 10 per customer )
  3. Items (Approximately 10,000 per customer configuration)

Then I will show a 3 level loop. At each "configuration" level I will start a DB transaction and compile the forumlab, each "item" will use the same transaction + compiled formulas (about 20 formulas per configuration, each item using them all Will).

It further complicates things because I can not use compiler services just because it will continuously develop memory usage

Any suggestions?

- UPDATE - I can not use a new AppDomain per "Level" level configuration because I need to pass some references.

- Update - this is what I went, thank you! You can create a simple square on the runtime, by typing your argument into a string or a choice, compile it,


Comments