Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Future Queries

Check out this video about Future Queries for some more information!

Widget Connector
width500
urlhttp://www.youtube.com/watch?v=BoMxEWj3CMY&feature=player_embedded
height310

...

Code Block
languagecsharp
// build up multiple queries
var q1 = db.User
    .ByEmailAddress("one@test.com")
    .Future();
    
var q2 = db.Task
    .Where(t => t.Summary == "Test")
    .Future();
    
// this triggers the loading of all the future queries
var users = q1.ToList();

 

No data is retrieved until q1.ToList(); is executed. At that time, PLINQO knows to execute all the future queries automatically. The data is both batched and not retrieved until it is needed.

...

Code Block
languagecsharp
var db = new TrackerDataContext();

// build up queries
var q1 = db.User
    .ByEmailAddress("one@test.com")
    .Future();
    
var q2 = db.Task
    .Where(t => t.Summary == "Test")
    .Future();
    
// this triggers the loading of all the future queries
var users = q1.ToList();

 

In the example above, there are 2 queries built up, as soon as one of the queries is enumerated, it triggers the batch load of both queries.

...

Does not support anonymous types.

Next: LINQ to SQL Profiler