I am developing a simple class that maps any Tuples from database, by convention, to CLR objects.
Here in my work, i cannot use EntityFramework, because database is giant and we have splitted models and is impossible to cross different contexts.
So i started develop my own ORM mapper, that generate insert, update and delete commands.
i am trying to develop the select method, that generates select CMD.
This method receives a Expression<T, bool> filter by parameter that i want to filter the data.
One thing that i really want to use is something like:
int value = 1;
int valu2 = 40;
mapper.Select<MyEntity>(m => m.id> value && m.id<= value2);
The big problem is that filter.body.toString() generates a string as is, and, what i really want to do is to replace the values of “value” and “value2” by their values declared on their variables…
Someone can give me a light?
Really Thanks to all!
I parsed the expr tree in a simple manner, just to build the filter.
Here’s how i did it.