We have a UI where user can create an expression using telerik expression editor. Now since we would like to show this expression to the user everytime s/he lands up on this page and thus we store the expression in a database table as a string column. We fetch the expression as below:
string expression = expEditor.Expression.ToString()
where expEditor is the Expression Editor control on UI.
Now next time when user opens up the page, we would like to show the saved expression and evaluate it as well then and there.
For this, we found that "Dynamic Language Runtime" could help us evaulate the expression at runtime. But for that we must have the expression and that too of type "System.Linq.Expressions.Expression" I guess. However in our database, we have it as a string.
This is where the problem is. We are not able to cast the string value into "System.Linq.Expressions.Expression" so that we can use DLR to evaluate the expression at runtime. We are getting unable to tyoe cast error when we try to do so.
Please share your comments with us as soon as possible.