Skip to content

Instantly share code, notes, and snippets.

@JonathanMagnan
Last active January 12, 2017 03:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JonathanMagnan/e0905a611a8230e1dbb798abbf5d991f to your computer and use it in GitHub Desktop.
Save JonathanMagnan/e0905a611a8230e1dbb798abbf5d991f to your computer and use it in GitHub Desktop.
// using Z.EntityFramework.Plus; // Don't forget to include this.
var ctx = new EntitiesContext();
// The first call perform a database round trip
var countries1 = ctx.Countries.FromCache().ToList();
// Subsequent calls will take the value from the memory instead
var countries2 = ctx.Countries.FromCache().ToList();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment