home recent topics recent posts search register faq   AspNetForum v.4.8.2.0

Huagati Systems Support Forum :: Forum

user:
psw:
| lost password
Home » Huagati Linq-to-SQL Profiler Support » how to get started with the Linq To Sql Profiler Messages in this topic - RSS
9/16/2009 3:01:34 PM
mkamoski
Posts 43
Huagati --

Please help.

I need to know how to get started with the Huagati Linq To Sql Profiler.

I have the DLL properly referenced.

And now I am stuck, as follows.

//At the following link...
//
// http://www.huagati.com/L2SProfiler/runtimehelp/html/M_Huagati_LinqToSQL_Profiler_ProfilingExtensions_BeginProfiling.htm
//
//...it says to use a callsite like the following...
//
Huagati.LinqToSQL.Profiler.QueryProfiler qp = myContext.BeginProfiling();
//
//...but that line throws the following run-time-error (RTE)...
//
//Error 1 'Team.Clear.BusinessLayer.BusinessEntities.DataClassesContext' does not contain a definition for 'BeginProfiling' and no extension method /
//'BeginProfiling' accepting a first argument of type 'Team.Clear.BusinessLayer.BusinessEntities.DataClassesContext' could be found (are you missing a
//using directive or an assembly reference?) C:\Code\Team\Clear\Clear.BusinessLayer\BusinessManagers\Generated\DhsProcessingRecordManager.cs 45 61 //Team.Clear.BusinessLayer
//
//...where we note that the code "Huagati.LinqToSQL.Profiler.QueryProfiler" does resolve and is NOT throwing a RTE...
//
//...so, it is the call to BeginProfiling() that throws the RTE...
//
//...and note that the help docs show this signature...
//
//public static QueryProfiler BeginProfiling(this DataContext dc)
//
//...but this is odd because there is no such static method found in IntelliSense on qp above...
//
//...furthermore it is odd because the signature in the help docs shows an arg where as the code sample does not show an arg.
//
//...so what am I missing?

Please advise.

Thank you.

-- Mark Kamoski
9/16/2009 3:10:12 PM
Kristofer
Posts 240
Hi Mark,

In the file where you call BeginProfiling, do you have a using statement referencing the profiler namespaces?

If not, add the following lines to the header of the file:

using Huagati.LinqToSQL.Profiler;
using Huagati.LinqToSQL.Profiler.Filters;

Best regards,
Kristofer
9/16/2009 3:21:59 PM
mkamoski
Posts 43
Kristofer wrote:
Hi Mark,

...add the following lines to the header of the file:

using Huagati.LinqToSQL.Profiler;
using Huagati.LinqToSQL.Profiler.Filters;



Nice.

That works insofaras it does not have a CTE and the BeginProfiling() method is available off the DataContext.

However, the unit test runs and there are no rows in the log after a refresh.

My code is below...


using System;
using System.Collections;
using System.Collections.Generic;
using System.Data.Linq;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Web;
using Huagati.LinqToSQL.Profiler;
using Huagati.LinqToSQL.Profiler.Filters;

namespace Team.TestProject.BusinessLayer.BusinessManagers
{
/// <summary>
/// This is a core interface implementation class.
/// </summary>
/// <remarks>
/// This code was generated '2009-Sep-15-Tue 10:30:12.5365230 AM -04:00' and it should not be modified manually.
/// </remarks>
public partial class ProcessingRecordManager :
Team.Framework.Interfaces.BusinessLayer.BusinessEntities.IL2sEntityManager
{
#region HelperMethods

/// <summary>
/// This will save the given new new object thereby creating it.
///</summary>
/// <param name="targetEntity">This is the object to create.</param>
public void Create(object targetEntity)
{
if (targetEntity == null)
{
throw new System.ApplicationException("The given object, targetEntity, is null.");
}
else
{
//Continue.
}

Team.TestProject.BusinessLayer.BusinessEntities.ProcessingRecord myEntity =
(Team.TestProject.BusinessLayer.BusinessEntities.ProcessingRecord)targetEntity;

using (Team.TestProject.BusinessLayer.BusinessEntities.DataClassesContext myContext =
new Team.TestProject.BusinessLayer.BusinessEntities.DataClassesContext(Team.TestProject.BusinessLayer.BusinessComponents.EntityHelper.GetConnectionString()))
{
QueryProfiler myQueryProfiler = myContext.BeginProfiling();
myContext.DeferredLoadingEnabled = false;
myEntity.SynchroniseWithDataContext(myContext);
myContext.SubmitChanges();
myQueryProfiler.EndProfiling();
}
}



...
9/17/2009 6:18:19 AM
Kristofer
Posts 240
If using the BeginProfiling overload, the default log directory is [user document directory]\L2SProfiler, e.g. C:\Users\[username]\Documents\L2SProfiler on Vista/Win7 or C:\Documents and Settings\[username]\My Documents\L2SProfiler on XP/2003. (For the user that the app is running as). Check if that folder exist and/or if there are any subdirectories and files in it.

If the profiler don't write anything to the log directory, check the permissions on that folder and/or try pointing it to a specific directory by using one of the BeginProfiling overloads that accept a log path: dc.BeginProfiling(@"c:\temp\profilerLog");

There is also a LogError event on the QueryProfiler object that you can use to detect if an error occurs during logging. That event is raised whenever the logging component encounter an error when trying to write to the log -- it uses an event instead of raising exceptions to avoid causing any undesirable side effects in the app that is being profiled...

QueryProfiler profiler = this.BeginProfiling(@"c:\temp\restricted");
profiler.LogError += new EventHandler(L2SProfiler_LogError);

private void L2SProfiler_LogError(object sender, EventArgs e)
{
LogErrorEventArgs args = (LogErrorEventArgs)e;
System.Diagnostics.Debug.Assert(false, "Profiler logging failed - " + args.ErrorMessage);
}
pages: 1
|

Home » Huagati Linq-to-SQL Profiler Support » how to get started with the Linq To Sql Profiler