Runtime expression engine

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there, I figured that there must be someone knew this-- I'm looking for a
runtime expression evaluation engine for our business rule engine. A typical
case is passing in a expression at runtime and engine return a bool/
calculated result.

I found some code on the internet, like
http://www.codeproject.com/csharp/runtime_eval.asp. My concern is more on the
performance side ,and I'm wondering if this is the right path to go.

Welcome any inspiriting thought!
 
From your description of what you want, this is overkill. All you want
is to evaluate mathematical expressions, no? You don't need to generate
arbitrary C# code and compile and run it, do you?

Question: will you be evaluating one expression many times over for
many inputs, or is it more likely that the expression to evaluate will
be constantly changing?

If you will be evaluating one expression over and over for different
inputs then maybe this runtime code compiler / generator will work for
you, since you would take a large hit up front to compile the C# code,
then it would run with maximum efficiency afterward.
 
Hi Bruce, my case is that I have mutiple expression need to evaluate on
different things and expression is quite different from one to the other. I'm
not sure about "overkill" since the expression requires flexibility.

Any thought?
 
What's your estimate of the workload for this expression engine?
There's only one other way I know how to do what you're trying to do in
..net and that's to write a function in jscript to take advantage of its
eval function. You could easily create a test app to compare the
performance of both techniques.
 
I say overkill because the link you provided is for software that will
compile any C# code. It seems to me that you just want the expression
engine, not the full power of a programming language. That's what I
meant by "overkill".
 
I agree. The functionality in the link you posted is simple enough to
use. Plug it into your application and try it to see if it performs
well enough. Hunt for something different only if it's not performant.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top