简体   繁体   中英

Serializing and Deserializing Expression Trees in C#

有没有办法在C#中反序列化表达式,我想将表达式存储在数据库中并在运行时加载它们。

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/

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

UPD: Now http://archive.msdn.microsoft.com/exprserialization

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.

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

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.

WCF RIA Services allows for serializing IQuerayble<T>

WCF RIA Services Part 3 – Updating Data

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM