Interessante codice x poter salvare i log di Linq to Sql con log4net: " DataContext Log Property can be used to print generated SQL query or command in the console window as shown below: db.Log = Console.Out;
If you want to print the SQL query in DebugView or VS Output window you may use DebugWriter class(by Kris Vandermotten) .The usage of the class is pretty simple ...
db.Log = new DebugWriter();
I wrote a small class that help you redirect DataContext messages to log4net .I've changed the DebugWriter and call it Log4NetWriter . The usage is still...