// Factory
 public static RecipeContext ContextFactory([CallerMemberName] string memberName = "")
 {
     var context = new RecipeContext();
     context.Configuration.LazyLoadingEnabled = false;
     context.CallingMethod = memberName;
     context.Database.Log = val => Trace.WriteLine(val);
     return context;
 }
Exemple #2
0
        // Factory
        public static RecipeContext ContextFactory([CallerMemberName] string memberName = "")
        {
            var context = new RecipeContext();

            context.Configuration.LazyLoadingEnabled = false;
            context.CallingMethod = memberName;
            context.Database.Log  = val => Trace.WriteLine(val);
            return(context);
        }
        // Factory
        public static RecipeContext ContextFactory([CallerMemberName] string memberName = "")
        {
            var context = new RecipeContext();
            // Don't use migrations. Just accept the structure and manage database schema manually.
            Database.SetInitializer<RecipeContext>(null);

            context.Configuration.LazyLoadingEnabled = false;
            context.CallingMethod = memberName;
            context.Database.Log = val => Trace.WriteLine(val);
            return context;
        }