Last active
January 12, 2017 03:02
-
-
Save JonathanMagnan/9734336658b8e52737c9a62447769f0b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// using Z.EntityFramework.Plus; // Don't forget to include this. | |
var ctx = new EntitiesContext(); | |
// CREATE a pending list of future queries | |
var futureCountries = db.Countries.Where(x => x.IsActive).Future(); | |
var futureStates = db.States.Where(x => x.IsActive).Future(); | |
// TRIGGER all pending queries in one database round trip | |
// SELECT * FROM Country WHERE IsActive = true; | |
// SELECT * FROM State WHERE IsActive = true | |
var countries = futureCountries.ToList(); | |
// futureStates is already resolved and contains the result | |
var states = futureStates.ToList(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment