Skip to content

Instantly share code, notes, and snippets.

@danielmackay
Created December 5, 2014 00:52
Show Gist options
  • Save danielmackay/f63f837d135500180473 to your computer and use it in GitHub Desktop.
Save danielmackay/f63f837d135500180473 to your computer and use it in GitHub Desktop.
Standard DB Context factory. #ef
public static osram_devEntities Create()
{
var db = new osram_devEntities();
// By turning off lazy loading entities must be explicitly loaded by using Include(). This means we don't accidently make
// calls to the DB that we're not aware of
db.Configuration.LazyLoadingEnabled = false;
#if DEBUG
db.Database.Log = (s) => Debug.WriteLine(s);
#endif
return db;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment