How to diagnose Linq to SQL easily and production-ready
Here's what we're currently doing: we add an InitializeContext method to all DataContext-derived classes, which is called from all ctors:
private void InitializeContext()
{
#if DEBUG
if (Debugger.IsAttached)
{
this.Log = new DebuggerTextWriter();
}
#endif
...
Read full article