views:

3132

answers:

4

Is there a way to Deserialize Expressions in C#, I would like to store Expressions in a Database and load them at run time.

+1  A: 

Not in full; however, the Dynamic LINQ sample may help a bit. You can certainly serialize an expression to a string (to an extent - generics look a bit screwy), but there is no inbuilt parser.

Marc Gravell
+4  A: 

If xml serialization of expression trees is suitable for you then,

there's an project on codeplex called MetaLinq that aims to make working with expression tress more easy. It also allows expression trees serialization to xml.

Also check this blog post for more info.

Pop Catalin
+6  A: 

Other option is the Expression Tree Serialization project on code.msdn.com - would appear to be more what is needed here?

Rich
+2  A: 

WCF RIA Services allows for serializing IQuerayble<T>

WCF RIA Services Part 3 – Updating Data

Jonathan Parker