Reputation: 251
I'm using ADO.NET Entity Framework for our business application in ASP.NET website. We're using WCF and LINQ to query the data source. My problem is that data loading from database (for e.g. to load data in gridview) is taking much more time than expected, so we want to log statements in ado.net generated sql statement so we can see which query is taking more time .
How to do this?
Upvotes: 0
Views: 350
Reputation: 48537
I would strongly suggest that you use SQL Profiler rather than creating your own logging mechanisms.
Microsoft SQL Server Profiler is a graphical user interface to SQL Trace for monitoring an instance of the Database Engine or Analysis Services. You can capture and save data about each event to a file or table to analyze later. For example, you can monitor a production environment to see which stored procedures are affecting performance by executing too slowly.
In your C# application, in your ConnectionString
, add Application Name=yourApp
. This will make it easier to locate in SQL Profiler.
Upvotes: 1