ASP.NET Core + ServiceStack.MiniProfiler

According to the docs there should be a ProfiledDbConnection class in MiniProfiler. However, even with the following using statements it doesn’t seem to be pulled in.

using ServiceStack.MiniProfiler;
using ServiceStack.MiniProfiler.Data;

Seems to find ProfiledConnection but not ProfiledDbConnection. However this other MiniProfiler discussion questions whether it’s available in .NET Core.

Is the ProfiledDbConnection not available in .NET Core?

In case it helps

var connectionFactory = new OrmLiteConnectionFactory(connectionString)
            {
                ConnectionFilter = x => new ProfiledDbConnection(x, Profiler.Current)
            };
            
connectionFactory.RegisterConnection("db1",
 new OrmLiteConnectionFactory(db1ConnStr,                                                                               PostgreSqlDialect.Provider, true)
 { ConnectionFilter =  x => new ProfiledDbConnection(x, Profiler.Current) });
            
connectionFactory.RegisterConnection("db2",
 new OrmLiteConnectionFactory(db2ConnStr,                                                                               PostgreSqlDialect.Provider, true)
 { ConnectionFilter =  x => new ProfiledDbConnection(x, Profiler.Current) });

connectionFactory.RegisterConnection("db3",
     new OrmLiteConnectionFactory(db3ConnStr,                                                                               PostgreSqlDialect.Provider, true)
 { ConnectionFilter =  x => new ProfiledDbConnection(x, Profiler.Current) });

container.Register<IDbConnectionFactory>(connectionFactory);

When using ProfiledConnection instead of ProfiledDbConnection, Profile.Current doesn’t work b/c it’s not an IDbProfiler. However I don’t see a IDbProfiler option.

Maybe it’s been a long day and I’m missing something simple…

Mini Profiler is not available in .NET Core.

Thanks! Not sure if this question comes up a lot, if it does, it might help to indicate that somewhere in the MiniProfiler docs.

http://docs.servicestack.net/built-in-profiling#using-the-mvc-mini-profiler

It mentioned MiniProfilerFeature was in the ServiceStack.NetFramework package in comments, but I’ve extended it to explicitly say it’s not available for .NET Core.

Hey guys, as per the forum link already referenced, I mention that I blogged about this already, I managed to get dotnetcore to work with Miniprofiler a while ago.

http://inayearorso.io/2018/04/18/servicestack-miniprofiler-dotnetcore-angular2/

ymmv

1 Like

Thanks Dale I’ve added a link to your post in the docs:

I’m assuming you’ll no longer need the pre-release package (from your post) now that v4.0.138 of MiniProfiler.AspNetCore.Mvc is released now?

Hi, sorry, i thought i replied to this earlier but i must have no hit SEND. Honestly, I got pulled onto another legacy framework project, so I haven’t worked on the profiled .netcore code for a while, so I can only presume that my use of prerelease is incorrect now - I’d try to use the official release as you note.

The v4 miniprofler is supporting .NET Core. Can we expect support in SS in .NET Core for MiniProfiler?

Ideally with ASP.NET Core it should be able to measure the request pipeline as middleware without having to be built in.

Here is MiniProfiler for .NET Core Documentation.
https://miniprofiler.com/dotnet/AspDotNetCore

1 Like