Serializing and Deserializing Expression Trees in

2019-01-01 05:23发布

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

7条回答
闭嘴吧你
2楼-- · 2019-01-01 05:43

I continued work on the library that was mentioned by Serializing and Deserializing Expression Trees in C#

It looks like the project was abandoned (2008) but I did some work on it and now it works with .NET 4.0 and Silverlight. I made bug fixes to their code and also made it more DAL-independent.

http://expressiontree.codeplex.com/

查看更多
情到深处是孤独
3楼-- · 2019-01-01 05:45

have a look at my new library Serialize.Linq. It serializes linq expressions to json, xml and binary.

查看更多
素衣白纱
4楼-- · 2019-01-01 05:48

WCF RIA Services allows for serializing IQuerayble<T>

WCF RIA Services Part 3 – Updating Data

查看更多
君临天下
5楼-- · 2019-01-01 05:49

There's an project on GitHub/Nuget called MetaLinq that aims to make working with expression tress more easy.

It converts between normal Expressions and 'EditableExpressions' which are mutable and fully Serializable, so can be used with Json, Xml, Binary etc.

Also check this blog post for more info.

查看更多
忆尘夕之涩
6楼-- · 2019-01-01 06:01

I was working on a project for serializing expressions. It's OK and you can use it. http://www.codeproject.com/Articles/851187/ServicePredicateBuilder-for-creating-Serializable

查看更多
梦寄多情
7楼-- · 2019-01-01 06:03

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.

查看更多
登录 后发表回答