SQL Server查询可视化器–无法看到生成的SQL查询 [英] Sql Server Query Visualizer – Cannot see generated SQL Query

查看:97
本文介绍了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查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆