Dreaming in Code: Multi Linq
I was asked how we will approach the same Multi Query approach with Linq integration, here are some thoughts about it.
var posts = from post in data.Posts where post.User.Name == "Ayende" orderby post.PublishedDate desc; var postsCount = posts.Count(); posts.Skip(10).Take(15); new LinqQueryBatch() .Add(posts) .Add(postsCount) .Execute();//perform the query foreach(Post p in posts)//no query { Console.WriteLine(p.ToString()); } //no query Console.WriteLine("Overall posts by Ayende: {0}", postsCount.Single() );
The LinqQueryBatch in this case doesn't need to pass delegates to process the results, it can modify the Linq Query directly, so trying to find the result will find the one that was already loaded when we executed the multi query.
Again, this is something that I am merely thinking about, no concrete code created.

Comments
Comment preview