.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

In EF 4.1 DbContext how to trace genrated SQL

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :ASP.Net

I wonder how to trace genrated SQL like DataContext in LinqToSql.

I also read articles about the solution of EFProviderWrapper on Jaroslaw Kowalski's blog, but it is based on ObjectContext, does not work for DbContext.

Anyone know how to do this in DbContext?

Thank you.

View Complete Post

More Related Resource Links

Nested Tracers - is there a way to only log the outer trace?



I have some nested tracers. The outer one has a category of 'PageTrace' and the inner ones have categories of 'DBTrace'. When I set the outer category source to 'All' I get both traces. When I switch on the inner trace, I just get the inner trace.

So, my question: is there any way to just log the outer trace events, i.e. the Page Traces.




Debugging Stack Trace

I have a VB.net dll that gets loaded as an add on to AutoCAD. I have it setup so that all exceptions get logged in a database table, along with the stack trace. The dll is on several users computers now for testing. On some computers, the stack trace returns line numbers, which is very helpful. Other computers do not give the line numbers on the stack trace for some reason. All computers are automatically updated, so they always have the same version of the dll. The DLL is built with full debug information. Do you know why some computers would return the line numbers and others would not?  

adding filter to sqldiag profiler trace

Hi everyone I'm wanting to create some standard diagnostics scripts for SQL Server 2005 installations and sqldiag seems the most logical way to do this. However, I want to be able to add filters to ProfilerCollector so that I can capture data for a specific database, application, etc. I've searched but can not find any information on either adding filters - which I suspect that you can not do - or specifying filters by using the template attribute.  However, Profiler itself does not seem to export templates as .xml which is the format of the default file specified for the template attribute! Does anyone know if adding filters is possible, by whatever mechanism, and if so does anyone have any examples?  It would be very much appreciated. thanks, and regards Simon

Extend running trace

I've got a trace running, created with sp_trace_create and a stop time.  Is there any way to extend this stop time? Obviously I can start another one at the relevant time but it's going to be convenient to keep this one running.

Why would enabling trace.axd change the way an app works?

Hi Guys,We have a page with a flash control on, on this page the flash control allows the user to upload a file and gives a progress report. When done the tool calls another page called SaveUpload.aspx which saves the file. The tool was not able to call this page for some reason and as soon as I turned on tracing it allowed the page to be called.Anyone seen behaviour like this before?Cheers,Pete

Cannot retrieve trace definition for SQL Server version

I am getting this error when I try to start  "New Trace" from Sql server Profiler. Cannot retrieve trace definition for SQL Server version 10.50.1600. Installation details Sql Server version : Sql 2008 R2 Developer edition Sql Management Studio, Profiler version : 10.50.1600.1   I referred this post http://social.msdn.microsoft.com/Forums/en-US/sqltools/thread/e61b4800-bd69-4819-955a-e1c53594e1ef/ My registry looks fine. Any sugestions? Thanks.Thanks and Regards, Senthil | Stop Genocide in Sri Lanka | www.tamilsagainstgenocide.org

Capture Stored Procedure Parameters in Trace

Hi, I want to capture each execution of all stored procedures and the parameters supplied, I'm going to do this via a trace on RPC:starting, capturing TextData, Database and starttime. I'll need to parse the TextData column to get the information that I want. I assume I also need to capture nested stored procedure calls , i.e. SP: starting as well. Does this sound correct and is this the best way of extracting this information ?Sean

Replication entries filling up default trace

I have noticed that a lot of replication related entries are filling up the default trace of my SQL installation, I like the default trace and like to use it for valuable information gathering. One thing that I do notice however is that its being filled with entries like   dbcc setinstance ("SQL Replication Distribution", "Dist:Delivery Latency", @agent_name, @delivery_latency)      dbcc incrementinstance ("SQL Replication Distribution", "Dist:Delivered Trans/sec", @agent_name, @new_delivered_transactions)          dbcc addinstance ("SQL Replication Distribution", @agent_name)            Anywhere I can turn this off and avoid such messages from being logged in the default trace.  

How to know the error cause using the stack trace in asp.net mvc

I am getting following error The model item passed into the dictionary is of type 'Helpers.PaginatedList`1[EntityLayer.Test]', but this dictionary requires a model item of type 'Helpers.PaginatedList`1[EntityLayer.Test]' And the stack trace is as follows at System.Web.Mvc.ViewDataDictionary`1.SetModel(Object value) at System.Web.Mvc.ViewDataDictionary..ctor(ViewDataDictionary dictionary) at System.Web.Mvc.ViewUserControl`1.SetViewData(ViewDataDictionary viewData) at System.Web.Mvc.WebFormView.RenderViewUserControl(ViewContext context, ViewUserControl control) at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass14.<InvokeActionResultWithFilters>b__11() at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)\n Inner Exception:\n I am not able to get what is the problem here?Can anybody help in this?

unable to trace value after postback within Custom Server Control

public class TextBox : AStateManagement, IControl { #region "Variables" #region "Local Variables" protected System.Web.UI.WebControls.WebControl _TextBox = null; protected string _CssClass = string.Empty; protected string _Text = string.Empty; protected bool _Visible = true; protected bool _Enabled = true; protected string _ID = string.Empty; protected bool _IsViewStateLoaded = false; #endregion "Local Variables" #region "Global Variables" #endregion "Global Variables" #endregion "Variable" #region "Constructor" public TextBox() { _TextBox = new System.Web.UI.WebControls.TextBox(); _TextBox.ID = this.UniqueID; } #endregion "Constructor" #region "Events" #endregion "Events" #region "Disposable" #endregion "Disposable" #region "Properties" public override string CssClass { get { return _CssClass; } set { _TextBox.CssClass = _CssClass = value; } } public virtual string Text { get { return _Text; }

Trace not working

I have a winforms application and I cannot seem to get trace to work.  I have the following setup in my config setup. <system.diagnostics> <sources> <!-- This section defines the logging configuration for My.Application.Log --> <source name="DefaultSource" switchName="DefaultSwitch"> <listeners> <add name="FileLog"/> <!-- Uncomment the below section to write to the Application Event Log --> <!--<add name="EventLog"/>--> </listeners> </source> </sources> <switches> <add name="DefaultSwitch" value="Information" /> </switches> <sharedListeners> <add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="c:\temp\TestTraceFile.txt"/> <!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log --> <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"

Missing column statistics from default trace

I am seeing Missing statistics events on my default trace and was wondering whether I need to create statistics on the table. Missing Column Statistics Is this a good practice considering the advice on http://msdn.microsoft.com/en-us/library/ms190397.aspx

About login name data column in DTA trace


Hi Experts,

In our organisation we r running microsoft dynamics nav as client and sql server 2008 std as backend, and at database level there is not a single user with showplan permission so, what i think is to exclude loginname data column from DTA trace. Am i right Sir? (As per my understanding).

Is there any script to view all  permissions for all user?

Does this way DTA would tune my DB as it should be? Or Is there any other fine way?

Thanks in advance

Snehal Trivedi

Does SQL Server has the similar function just like Trace Event 10104 for hash join in Oracle?


My question is  how can SQL server display the  information about the buckets when doing the hash join just like the function of Trace Event 10104 in Oracle.By the way ,In Oracle ,the Event 10104 event dumps hash join statistics .
The buckets message what i needed is similar as the following,that is to say ,it must contains the information about buckets .
01 ### Hash table ### 
02 # NOTE: The calculated number of rows in non-empty buckets may be smaller 
03 # than the true number. 
04 Number of buckets with 0 rows: 16373 
05 Number of buckets with 1 rows: 0 
06 Number of buckets with 2 rows: 0 
07 Number of buckets with 3 rows: 1

Konesans Trace File Source adapter


Found the handy Konesans Trace File Source adapter that allows reading of SQL Profiler trace (.trc) files, and it works well. The adapter has properties that allow for Variable-based filename property interpretation...however being a total SSIS noob, I am not familiar how to set up the variables so that it will read from a series of files in a directory. The method I am familiar with, of using a ForEach container doesnt really work because the adapter itself does not rely on a connection manager, and I am unable to set the variable name for it via an expression.

Anyone out there using this tool or have some pointers?



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend