Sunday, June 25, 2006

Queryable data store

It seems like my shout out for a sweeter handling of runtime queries against data store was on the agenda of the Microsofties Linq development team.

My proposed solution, however, has the extra feature of exposing the datamodel outside of its context, in order to be used for some type helping, for instance. That point is critical for me, as this is the only way to leverage all the work done inside of your software outside of your business scope. In a network economy, this is a crucial point for customers, as a software always need to fit in an ecosystem somehow, and that ecosystem plumbing is where a lot of cost and issue is.


If we go back to Linq, the added value this time is clearly the IQueryable interface.
Wanting to use Linq in a project, I ended up filling the dots exactly on the same place, around this notion of "data repository" with accept queries and translate them. This functionnality is now a standard feature of Linq, with the 2 main additions :


You can generate expression tree (aka build abstract representation of query from unstructured text)

    ParameterExpression p = Expression.Parameter(typeof(Customer), "c");

    LambdaExpression predicate = QueryExpression.Lambda("c.City = 'London'", p);

And turn those trees into actual function :
      Func<Customer,bool> d = predicate.Compile();


Now  you have a whole continuum for your Linq queries, ranging from static to dynamic, and you can handle back some control to your user.
Unfortunately, their only entry point is a ..... untyped string, which is precisely what Linq stands out against.


May be one day Microsoft will realize they need to do for end-user what they ambition with Linq for programmers, that is bring back some strong typing wherever we can, and they'll might end up with my solution and my genius will finally be recognized.

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home