I've blogged before (in hebrew) about the difficulty of serializing expression trees to XML. To conclude my hebrew post, I've found a project in CodePlex, called MetaLinq which might be the solution to the problem - this open source allows to perform Linq queries over expression trees, and as a consequence, might allow serialization of the navigable expression tree. I've worked in past few days to fix the code of the project to allow serializing the tree with DataContractSerializer. The...
אחד מהדברים השימושיים ב-3.0 #C, אע"פ שהוא מעט הוזנח במצגות השונות, הוא עץ הביטויים (Expression Tree) שהוא הדבק שמחבר את Lambda Expressions ו-Linq. מאחר ובאמצעות Expression Tree אפשר לייצג ביטוי לוגי, מצאתי לו שימוש במערכת בה הביטויים הלוגיים הם דינאמיים, המבנה שלהם נשמר ב-DB והם צריכים להיבנות ולהיבדק בזמן ריצה. אבל... בדבר אחד Expression Tree נכשל - אי אפשר לבצע לו סריאליזציה. הדבר מוסבר בפורומים השונים, כדוגמת כאן , והסיבות נשמעות די הגיוניות: המחלקות השונות של Expression Tree מכילות מאפיינים...