Debuggin before submitchanges() ?

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
Posts: 5
Joined: Fri 20 Feb 2009 23:09

Debuggin before submitchanges() ?

Post by rodusa » Fri 20 Feb 2009 23:14

How can I debug the generated sql statement before SubmitChanges()?

DbDataContext db = new DbDataContext();
.... // code here

db.SubmitChanges(); // Debug SQL here??????

On SQL Server there is a Visual debug analyzer. Is there anything similar for mysql?

Thank you


Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Mon 23 Feb 2009 15:20

The generated SQL statement cannot be shown before invoking the SubmitChanges() method. But you can see the SQL that was sent to the server after SubmitChanges():
1) either by the help of DBMonitor (refer to our documentation to find out how to use it),
2) or by this code:
StringBuilder sb = new StringBuilder();
databaseContext.Log = new StringWriter(sb);

Post Reply