Error while serializing an expression

Jul 29, 2011 at 10:58 AM
Edited Jul 29, 2011 at 11:00 AM

Hi,

I'm a beginner with Linq and I have an issue while using MetaLinq for a test.
I need to bind a gridview to data from a server using a Linq query. I looked on the web how to make a data provider, and now I'm trying to serialize the expression to send it to the server side so that it can execute it on the data.

Here is my code :

QueryableData<QueryableObject> objects = new QueryableData<QueryableObject>(); // QueryableData implements IOrderedQueryable

var query = objects.Where(obj => obj.name == "test").Select(obj => obj.name);

gridControl1.DataSource = query.ToList();
Then to get some data, in the method Execute(Expression) of the DataProvider I try to serialize the expression :
EditableExpression e = CheckSerializationInternal(EditableExpression.CreateEditableExpression(expression)); // CheckSerializationInternal is the same as in the MetaLinq demo
I got the error "There was an error generating the XML document" at line :
xs.Serialize(ms, mutableLambda); 
Here is the string value of "expression" :

{value(LinqDataAdapter.QueryableData`1[WCFIntefaces.QueryableObject]).Where(obj => (obj.name = "test")).Select(obj => obj.name)}
I'm sure I failed somewhere, but I can't find the reason why. I'm still a beginner...
Thanks for your help.
Axel