Using Glimpse for OrmLite logging

I have it all working via the same method laid out here (which uses the Glimpse “Manual ADO” integration)…

I’m just wondering if that is the preferred way of getting Glimpse hooked into OrmLite, or if there is a better/more preferred way?

I haven’t tried this, but you may be able to use the same ConnectionFilter approach that Mini Profiler uses, e.g:

this.Container.Register<IDbConnectionFactory>(c =>
    new OrmLiteConnectionFactory(connString, SqlServerDialect.Provider) {
            ConnectionFilter = x => new GlimpseDbConnection(x)
    });

Thanks. It was close. I had to cast x like…

container.Register<IDbConnectionFactory>(c =>
new OrmLiteConnectionFactory(AppSettings.GetString("AppDb"), SqlServerDialect.Provider)
{
    ConnectionFilter = x => new Glimpse.Ado.AlternateType.GlimpseDbConnection(x as System.Data.SqlClient.SqlConnection)
});

But it works great this way as well without having to do the separate SqlServerWithGlimpseDialectProvider class. Thanks @mythz!

1 Like