Created
December 5, 2014 00:52
-
-
Save danielmackay/f63f837d135500180473 to your computer and use it in GitHub Desktop.
Standard DB Context factory. #ef
This file contains hidden or 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
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