Convert LINQ query to string, send to remote server to parse into an expression using Roslyn?

.net c# dynamic-linq linq roslyn

Question

I have a datasource such as IDataSource : IEnumerable<IDynamicObject>

One implementation is quering pure XML-data and another is quering an SQL database.

My datasources have no conrete types, and are only working against simple schema-types.

In some scenarios, these datasources are instanced in the same runtime-context and other they are accessed over the network.

I wasn't to be able to query my datasources with LINQ, and I'm planning on using dynamic objects to only extract and parse the member values that are part of the actual query.

This works fine when running in the same runtime-context, but when the datasource is behind a web service on a remote server, this fails because I can't use LINQ with a web service in any way I know of.

So I was looking for a method of formatting my LINQ queries as a string and send this to the server, then parse it back to an expression and execute it in the new context.

Two methods of parsing expression I could find was Dynamic LINQ and FLEE. I have only looked at them briefly but none of them seemed to be able to format an expression to a string as well as parse it?

I've read about the Roslyn-project and was thinking maybee it could be used for this problem? Anyone know more about that?

I've looked some at IQueryable<TData> as well but I've read a lot of negative things about it so maybe I should avoid it. Also it is strongly typed which doesn't fit my needs because I don't wan't any concrete types on the data server. I also don't see how this can be used over a web service, being strongly typed? Am I missing something?

1
1
3/10/2012 4:32:01 PM

Popular Answer

Roslyn will eventually give you the ability to take a LINQ expression in string form, parse it, and evaluate it. However, the current public CTP (the one released October 2011) does not support LINQ expressions.

4
3/11/2012 2:49:58 AM


Related Questions





Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow