Is it possible to use variables of type Object in FLEE?

Mar 6, 2014 at 10:58 PM
Hi all,

Wonderful utility... so well done.

At present I use the variables collection to just store a string:

variables["a"]= "Hot"

so a="Hot" would return true.

However could I set up a variable of type object ie:

variables["a"] = myobject;

So the rule could be:

myobject.value = "Hot"

and taking this further, could one use this to access linked objects from EF like so:

a.Order.Supplier.Name = "Microsoft";

Thoughts really appreciated, and thanks in advance for any help.

Dec 24, 2014 at 4:03 PM
Edited Dec 24, 2014 at 4:04 PM

We can set any object to flee variable. Please refer below code

ExpressionContext context = new ExpressionContext();
context.Variables.Add("xyz", new MyClass {Name = "shiv"});
var expression = "xyz.Name.equals(\"shiv\")";
IGenericExpression<bool> e = context.CompileGeneric<bool>(expression);
bool result = e.Evaluate();

& a class

public class MyClass
    public string Name { get; set; }