Example #1
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;
 }
Example #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);
        }
Example #3
0
        // 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;
        }