The documentation states that I can turn on logging like this:
using (var context = new BlogContext())
{
context.Database.Log = Console.Write; // like this
context.Database.Log = logInfo => Debug.WriteLine(logInfo); // or like this
// Your code here...
// How can I turn off logging here ?
}
I don't see any information on how to turn it off. Can someone tell me how I can do this?
context.Database.Log
before you assign to it, what do you see? You should be able to use that same value to reset it. (I don't know what that value is. It might benull
, or it might be some method that ignores its argument.) – user743382 Mar 28 '14 at 10:16