views:

95

answers:

2

I need to see how subsonic generates the SQL Query string.

A: 

THIS WILL WORK FOR SUBSONIC 2.X ONLY

When you create query like this:

var q = new Select()
   .From(TableName.Schema)
   .Where(TableName.Columns.ColumnName)
   .IsEqualTo(SOME_VALUE).Or(TableName.Columns.OtherColumn)
   .IsEqualTo(OTHER_VALUE)
   ......;

you can dump SQL Query to somewhere or break after this line to view it in Debug Visualizer:

Debug.WriteLine(q.SQLCommand);
TheVillageIdiot
Im using subsonic 3.0
Fleents
+1  A: 

I either have Sql Profile listening on the database or if you're in debug mode with VS you can move the cursor over the linq statement and it is in the tooltip.

TWith2Sugars