本文介绍了SQL Server查询可视化器–无法看到生成的SQL查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有SqlServerQueryVisualizer.当我将鼠标悬停在"accounts"变量上时,我可以看到SQL.但是,当我将鼠标悬停在结果"变量上时,它没有显示SQL查询.在以下代码中如何查看结果"变量的SQL查询?
I have SqlServerQueryVisualizer. I can see the SQL when I hover on "accounts" variable. But when I hover on "results" variable, it is not showing the SQL query. How to see the SQL query for "results" variable in the following code?
public IEnumerable<T> FindAll(Func<T, bool> predicate) { LibraryManagementClassesDataContext db = new LibraryManagementClassesDataContext(""); var accounts = from p in db.Accounts where p.AccountNumber == 1 select p; //Where var results = Context.GetTable<T>().Where(predicate); return results; }
此外,我还有一个插入功能.如何查看此情况下生成的查询?
Also, I have a insert function. How to see the generated query for this scenario?
public virtual void InsertOnSubmit(T entity) { GetTable().InsertOnSubmit(entity); }推荐答案
问题中所述的问题仍然存在.
The problem stated in the question still exists.
当前,我正在使用以下类在输出窗口中查看结果.
Currently I am using the following class for seeing the result in output window.
context.Log = new OutputWindowWriter(); class OutputWindowWriter : System.IO.TextWriter { public override void Write(char[] buffer, int index, int count) { System.Diagnostics.Debug.Write(new String(buffer, index, count)); } public override void Write(string value) { System.Diagnostics.Debug.Write(value); } public override System.Text.Encoding Encoding { get { return System.Text.Encoding.Default; } } }更多推荐
SQL Server查询可视化器–无法看到生成的SQL查询
发布评论