I've got a LINQ query that looks like this (at the end):
我有一个看起来像这样的LINQ查询(最后):
var query = from myTable0 ... where myTable1.attributeId == 123 && (bunchaStrings.Contains(myTable1.attributeName)) && myTable2.yesNoValue == 'Y'
var query = from myTable0 ... where myTable1.attributeId == 123 &&(bunchaStrings.Contains(myTable1.attributeName))&& myTable2.yesNoValue =='Y'
When I see the query it turns into this
当我看到查询时,它变成了这个
SELECT ... FROM ... INNER JOIN ... WHERE ... AND (UNICODE([t3].[yesNoValue]) = @p3
SELECT ... FROM ... INNER JOIN ... WHERE ... AND(UNICODE([t3]。[yesNoValue])= @ p3
So what's happening here is that the value of 'Y' is getting turned into '89' via the UNICODE function. That's all fine, but I'd really like to just be able to see the value of @p3 directly and I can't figure out how to see that value via any methods available from my var.
所以这里发生的是'Y'的值通过UNICODE函数变成'89'。这一切都很好,但我真的希望能够直接看到@ p3的值,我无法弄清楚如何通过我的var中提供的任何方法来查看该值。
2 个解决方案
#1
I would recommend piping the generated SQL out to the output window. There you will be able to see the whole SQL and your parameters values. Then it can also be logged.
我建议将生成的SQL管道输出到输出窗口。在那里,您将能够看到整个SQL和您的参数值。然后它也可以被记录。
Code for it can be found here -> http://www.u2u.info/Blogs/Kris/Lists/Posts/Post.aspx?ID=11
它的代码可以在这里找到 - > http://www.u2u.info/Blogs/Kris/Lists/Posts/Post.aspx?ID=11
Or an easier method (if you've got a handy console around):
或者更简单的方法(如果你有一个方便的控制台):
MyDataContext context = new MyDataContext()
context.Log = Console.Out
#2
You may also be interested in the LINQ to SQL Visualizer : http://weblogs.asp.net/scottgu/archive/2007/07/31/linq-to-sql-debug-visualizer.aspx
您可能还对LINQ to SQL Visualizer感兴趣:http://weblogs.asp.net/scottgu/archive/2007/07/31/linq-to-sql-debug-visualizer.aspx
#1
I would recommend piping the generated SQL out to the output window. There you will be able to see the whole SQL and your parameters values. Then it can also be logged.
我建议将生成的SQL管道输出到输出窗口。在那里,您将能够看到整个SQL和您的参数值。然后它也可以被记录。
Code for it can be found here -> http://www.u2u.info/Blogs/Kris/Lists/Posts/Post.aspx?ID=11
它的代码可以在这里找到 - > http://www.u2u.info/Blogs/Kris/Lists/Posts/Post.aspx?ID=11
Or an easier method (if you've got a handy console around):
或者更简单的方法(如果你有一个方便的控制台):
MyDataContext context = new MyDataContext()
context.Log = Console.Out
#2
You may also be interested in the LINQ to SQL Visualizer : http://weblogs.asp.net/scottgu/archive/2007/07/31/linq-to-sql-debug-visualizer.aspx
您可能还对LINQ to SQL Visualizer感兴趣:http://weblogs.asp.net/scottgu/archive/2007/07/31/linq-to-sql-debug-visualizer.aspx