I am using MVC3, Razor, C# and EF4.1.
I am trying to implement some rule processing logic, and using the excellent FLEE rule processor at present. So rules such as :
a>1 and a<100
can be stored in the DB and processed at runtime. Great. However this assumes that I can preload "a" which in simple case I can. However sometimes it is necessary to get more detailed with my query and a dynamic type of LINQ would be great, ie
context.animals.first(r=>r.specie=="dog").Name
So one could then use this in the complete rule like:
(context.animals.first(r=>r.specie=="dog").Name) = "Rover"
It is "=" in FLEE and not "==" btw.
So can one implement dynamic LINQ queries and how?
The only other approach I can think of is substitution and use of switch ie:
{DogName}="Rover"
switch (argname)
{
case "DogName" :
myValue = db.Animals.First(r=>r.specie=="Dog").Name
break;
}