Otis wrote:
Stored proc tracing isn't currently available. In v3.1, stored procedures are executed using DataAccessAdapterBase.CallActionStoredProcedure and CallRetrievalStoredProcedure. These methods get the stored proc name, parameters and what to fill passed in (in the case of a retrieval proc).
To add the tracing, you could override these two methods in a partial class of the dataaccessadapter and add the tracing calls there. You can trace easily with TraceHelper.WriteLineIf(<switch>.<flag>, caption, message), see the TraceHelper class in the runtime lib for details.
Thanks.
I added my code here under.
Which method should I override for Retrieval Procude fetched into TypedViews ?
adapter.FetchTypedView(typedView,
RetrievalProcedures.Get...CallAsQuery(...));
Do you plan to integrate SP tracing into the future ?
public override int CallActionStoredProcedure(string storedProcedureToCall, System.Data.Common.DbParameter[] parameters)
{
var trace = new StringBuilder();
trace.AppendLine("Procedure name: " + storedProcedureToCall);
if (parameters != null)
foreach (var param in parameters)
{
if (param.Direction == ParameterDirection.Input || param.Direction == ParameterDirection.InputOutput)
if (param.Value == null || param.Value == DBNull.Value)
trace.AppendLine("Input parameter " + param.ParameterName + ": null");
else
trace.AppendLine("Input parameter " + param.ParameterName + ": " + param.Value);
}
var stopwatch = Stopwatch.StartNew();
try
{
return base.CallActionStoredProcedure(storedProcedureToCall, parameters);
}
finally
{
stopwatch.Stop();
if (parameters != null)
foreach (var param in parameters)
{
if (param.Direction == ParameterDirection.Output || param.Direction == ParameterDirection.InputOutput)
if (param.Value == null || param.Value == DBNull.Value)
trace.AppendLine(string.Format("Output parameter {0}: null", param.ParameterName));
else
trace.AppendLine(string.Format("Output parameter {0}: {1}", param.ParameterName, param.Value));
}
trace.AppendLine(string.Format("Call duration (milliseconds): {0}", stopwatch.ElapsedMilliseconds.ToString()));
TraceHelper.WriteLineIf(true, trace.ToString(), "DataAccessAdapterBase.CallActionStoredProcedure");
}
}