Skip to content

Instantly share code, notes, and snippets.

@robertmilne
Created June 11, 2011 00:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertmilne/1020093 to your computer and use it in GitHub Desktop.
Save robertmilne/1020093 to your computer and use it in GitHub Desktop.
var cfg = new Configuration()
.DataBaseIntegration(db => {
db.ConnectionStringName = "MyConnection";
db.Dialect<MsSql2008Dialect>();
db.Driver<ProfiledSql2008ClientDriver>();
});
using System.Data;
using System.Data.Common;
using MvcMiniProfiler;
using MvcMiniProfiler.Data;
using NHibernate.Driver;
namespace MyProject.Infrastructure
{
public class ProfiledSql2008ClientDriver : Sql2008ClientDriver
{
public override IDbCommand CreateCommand()
{
return new ProfiledDbCommand(
base.CreateCommand() as DbCommand,
null,
MiniProfiler.Current);
}
public override IDbConnection CreateConnection()
{
return ProfiledDbConnection.Get(
base.CreateConnection() as DbConnection,
MiniProfiler.Current);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment