Created
March 9, 2015 14:14
-
-
Save pinalbhatt/90da1ff10c401067d789 to your computer and use it in GitHub Desktop.
How to see the actual SQL query generated by Entity Framework in Visual Studio Debug Windows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (TailspinToysEntities context = new TailspinToysEntities()) | |
{ | |
context.Database.Log = s => System.Diagnostics.Debug.WriteLine(s); | |
var products = | |
from product in context.Products | |
where product.BasePrice > 5.00m | |
select product; | |
} | |
//This will show the SQL in the Output -> Debug window. | |
//Source: http://blogs.msdn.com/b/mpeder/archive/2014/06/16/how-to-see-the-actual-sql-query-generated-by-entity-framework.aspx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment