I'm trying to get it to record linq-to-sql in the mini profiler as the documentation says
I add this to my App_Code/DataClasses.designer.cs
as follows:
public MainContext() :
base(global::System.Configuration.ConfigurationManager.ConnectionStrings["ScirraConnectionString"].ConnectionString, mappingSource)
{
OnCreated();
}
// Code I'm adding in for the mini profiler
partial class DBContext
{
public static DBContext Get()
{
var conn = new MvcMiniProfiler.Data.ProfiledDbConnection(GetConnection(), MiniProfiler.Current);
return new DBContext(conn);
}
}
But it throws the error:
The name 'GetConnection' does not exist in the current context
I've also tried this:
partial class DBContext
{
public static DBContext Get()
{
var conn = ProfiledDbConnection.Get(new System.Data.SqlClient.SqlConnection(global::System.Configuration.ConfigurationManager.ConnectionStrings["ScirraConnectionString"].ConnectionString));
return new DBContext(conn);
}
}
But it throws
'MvcMiniProfiler.Data.ProfiledDbConnection' does not contain a definition for 'Get'
I've refered to How can I make the ASP.NET MVC mini profiler work with Linq 2 SQL? but none of the solutions in there seem to work for me.
Can anyone show me how I would get it working for linq-to-sql?