Integrating MvcMiniProfiler 1.9 and LLBLGenPro

Posts   
 
    
trancehead
User
Posts: 137
Joined: 03-Dec-2007
# Posted on: 18-Sep-2011 20:26:04   

Related to this thread: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=20109

The code provided at http://blog.rthand.com/post/2011/07/24/Integrating-MvcMiniProfiler-and-LLBLGenPro.aspx no longer runs and it seems to be an update to MvcMiniProfiler that has caused.

The problem is on the line

return ProfiledDbConnection.Get(conn);

The Get method is no longer available. I'm really keen to get this running so any help would be appreciated.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 19-Sep-2011 05:15:57   

This is a breaking change for v1.9: http://code.google.com/p/mvc-mini-profiler/issues/detail?id=109

Now you have to use the constructor, instead of the Get method. This is the code to solve the issue:

public class DataAccessAdapterExtended : DataAccessAdapter
{
    protected override System.Data.Common.DbConnection CreateNewPhysicalConnection(string connectionString)
    {
        DbConnection conn = base.CreateNewPhysicalConnection(connectionString);
        return new ProfiledDbConnection(conn, MiniProfiler.Current );
    }

    protected override DynamicQueryEngineBase CreateDynamicQueryEngine()
    {
        return PostProcessNewDynamicQueryEngine(new ProfilingDynamicQueryEngine());
    }
}
David Elizondo | LLBLGen Support Team
trancehead
User
Posts: 137
Joined: 03-Dec-2007
# Posted on: 19-Sep-2011 09:43:30   

Great, I'll look into that this evening when I'm working on it again.

mihies avatar
mihies
User
Posts: 800
Joined: 29-Jan-2006
# Posted on: 19-Sep-2011 10:50:03   

Indeed David's change fixes the problem. I've updated my blog post as well.

methodman
User
Posts: 194
Joined: 24-Aug-2009
# Posted on: 05-Jan-2012 12:43:28   

I'm having some trouble with the oracle provider and StoredProcedureCall class.

    using(StoredProcedureCall call = CreateCradDalsiaPrCall(dataAccessProvider, pkSkupiny, kodCRady, posunut, datum, uziv, oz, zvacsito, strFormat))
            {
                int toReturn = call.Call(); 
                strFormat = call.GetParameterValue<System.String>(7);
                return toReturn;
            }

On the line

int toReturn = call.Call(); 

i'm getting an exception

Unable to cast object of type 'MvcMiniProfiler.Data.ProfiledDbConnection' to type 'Oracle.DataAccess.Client.OracleConnection'.

This is just happening with StoreedProcedureCall, all other queries are working just fine.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 05-Jan-2012 14:44:24   

You're using v2.6 I presume? in v3 it should work as it uses the factory to create the proc commands.

Frans Bouma | Lead developer LLBLGen Pro
methodman
User
Posts: 194
Joined: 24-Aug-2009
# Posted on: 06-Jan-2012 00:27:27   

I'm using the 3.1 version actually. But this error happens only when a stored procedure call is made.

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 06-Jan-2012 10:34:58   

Could you please post the stack trace.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 06-Jan-2012 11:15:32   

It could be something inside the mvcminiprofiler, I do recall it works in our own profiler (which uses interception as well).

Frans Bouma | Lead developer LLBLGen Pro
Posts: 1
Joined: 13-Feb-2012
# Posted on: 13-Feb-2012 07:42:43   

i'm trying to follow Miha's example in his post, but i'm missing the PostProcessNewDynamicQueryEngine method. i'm using LLBLGen version 2.5.. unfortunately cry

could someone help me out ?

mihies avatar
mihies
User
Posts: 800
Joined: 29-Jan-2006
# Posted on: 13-Feb-2012 08:44:44   

reyrahadian wrote:

i'm trying to follow Miha's example in his post, but i'm missing the PostProcessNewDynamicQueryEngine method. i'm using LLBLGen version 2.5.. unfortunately cry

could someone help me out ?

I don't have v2.5 handy but I can suggest you to check the code of the mentioned method with .net reflector or any other such tool and then implement it accordingly. Just check out the code generated by LLBLGenPro - DataAccessAdapter.