public class LinqDebugger : System.IO.TextWriter
{
static readonly LinqDebugger _instance = new LinqDebugger();
static readonly string _separator = new String('_', 150);
public static LinqDebugger Instance { get { return _instance; } }
private LinqDebugger()
{
}
public override void WriteLine(string value)
{
System.Diagnostics.Debug.WriteLine(value);
if (!string.IsNullOrEmpty(value) && value.StartsWith("-- Context:"))
System.Diagnostics.Debug.WriteLine(_separator);
}
public override System.Text.Encoding Encoding
{
get { throw new NotImplementedException(); }
}
}
Use:
var db = new DBDataContext();
db.Log = LinqDebugger.Instance;
VS output:
Немає коментарів:
Дописати коментар