Answered by:
Dynamically generate lambda expressions

Question
-
I need to dynamically generate lambda expressions, so far the only thing I have come up with is
I am a bit hesitant to use sample code, is there a better way to get this done?
Monday, August 15, 2011 9:30 AM
Answers
-
On 8/15/2011 5:30 AM, John Foot wrote:> I need to dynamically generate lambda expressions, so far the only thing> I have come up with is>>> I am a bit hesitant to use sample code, is there a better way to get> this done?>What better way? This is no different than you making dynamic inlineT-SQL and submitting it for execution.You might want to look at this.But my thing is keep it simple which your link seems to be doing.
- Proposed as answer by Alan_chenModerator Tuesday, August 16, 2011 9:39 AM
- Marked as answer by Alan_chenModerator Tuesday, August 23, 2011 3:34 AM
Monday, August 15, 2011 11:24 AM
All replies
-
Hi,
Some more context could help. For example if this is for a user criteria input form you could either construct the where clause in several steps or you could also generate an ESQL query (http://msdn.microsoft.com/en-us/library/bb387145.aspx) if you want something even more general.
The EF forum might be better depending on what is your overall goal (you are using Linq To Sql or EF or neither, what is your context ?).
Please always mark whatever response solved your issue so that the thread is properly marked as "Answered".
Monday, August 15, 2011 9:54 AM -
On 8/15/2011 5:30 AM, John Foot wrote:> I need to dynamically generate lambda expressions, so far the only thing> I have come up with is>>> I am a bit hesitant to use sample code, is there a better way to get> this done?>What better way? This is no different than you making dynamic inlineT-SQL and submitting it for execution.You might want to look at this.But my thing is keep it simple which your link seems to be doing.
- Proposed as answer by Alan_chenModerator Tuesday, August 16, 2011 9:39 AM
- Marked as answer by Alan_chenModerator Tuesday, August 23, 2011 3:34 AM
Monday, August 15, 2011 11:24 AM -
You can dynamically construct a lambda expression using the Expression.Lambda methodWednesday, August 17, 2011 10:11 AM