locked
XML Serialize an expression tree RRS feed

  • Question

  • can i xml serialize an expression tree ?

    Expression<Func<myClass,bool>> exp = Expression.Lambda<Func<myClass,bool>>(binaryExpression,param); 
    Monday, August 4, 2008 1:54 PM

Answers

  •  I notice you didn't actually answer the question. You instead said, "I want it to be serialized to that it can be deserialized into an expression tree again and then executed remotely".

    This begs the questions, "is it possible to remotely execute an expression tree at all" and "is it possible to use serialization to transfer an expression tree so that it can be remotely executed".

    Neither of those is an XML Serialization question - they're both "expression tree" questions. You should ask in LINQ Project General, then post a link to your new thread here, so that interested parties may follow the discussion. I, personally wonder if it is possible to remove all variables from such an expression tree; if the tree has variables in it, then what would it even mean in a location remote from the actual variables?

    John Saunders | Use File->New Project to create Web Service Projects
    Tuesday, August 5, 2008 12:11 PM
    Moderator

All replies

  • What do you want the result to look like? What do you want a client to do with the result?

    John Saunders | Use File->New Project to create Web Service Projects
    Tuesday, August 5, 2008 1:35 AM
    Moderator
  • Thank you ,

    i want to save the expression (that represents the WHERE sentence in a query)
    in the database as xml serialized data.

    when the user wants to extract data from the database by a query, he extract the expression
    and the program will create a query dynamically for him using that expression.

    Thats why i need to find a way to xml serialize an expression tree.

    please help....
    Tuesday, August 5, 2008 4:41 AM
  •  I notice you didn't actually answer the question. You instead said, "I want it to be serialized to that it can be deserialized into an expression tree again and then executed remotely".

    This begs the questions, "is it possible to remotely execute an expression tree at all" and "is it possible to use serialization to transfer an expression tree so that it can be remotely executed".

    Neither of those is an XML Serialization question - they're both "expression tree" questions. You should ask in LINQ Project General, then post a link to your new thread here, so that interested parties may follow the discussion. I, personally wonder if it is possible to remove all variables from such an expression tree; if the tree has variables in it, then what would it even mean in a location remote from the actual variables?

    John Saunders | Use File->New Project to create Web Service Projects
    Tuesday, August 5, 2008 12:11 PM
    Moderator