简体   繁体   中英

Why I can't see my T-SQL string generated by a queryable

I'm noticed that some queries in my application are so slowly, so that's the reason why I want to know what is trying to accomplish my queries in LINQ TO SQL through entity framework.

In some sites, I realized that if you put your mouse over the IQueryable variable, you can see the T-SQL generated and at this moment, I can't see that.

在此处输入图片说明

I'd like to know if I'm doing a wrong configuration in my Entity Framework model

对于Entity Framework,您可以通过检查上下文的Log属性来查看生成的SQL查询,或者可以将IQueryable ToTraceString()System.Data.Objects.ObjectQuery并使用方法ToTraceString()

I want to suggest a different approach: Look at the real query in SQL Profiler. You can see all queries executed including parameter values. You can copy the query including parameter assignments to SSMS to debug it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM