views:

83

answers:

1

I am trying to build expression strings for use with IOC extended nHydrate. When I call ToString() on my expression I get something like this:

employee => employee.Username == value( Some type name here )

Is there a way to resolve that value call to the actual value?

employee => employee.Username == "Captain Spiffy"
+1  A: 

Doing a ToString() would only fetch you the end expression result, If it is a real expression tree, Like a Expression> then you can traverse the expressions tree using the Expression Visitor class. Make sure this is not a Func!

-Fahad

Fahad
It's an Expression<Func<T,bool>> is that going to cause me problems?
Nick Daniels
No, Expression<> would only wrap your Func into an expression tree, You can always get the Func by calling the Compile().
Fahad