Created
June 11, 2011 00:32
-
-
Save robertmilne/1020093 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cfg = new Configuration() | |
.DataBaseIntegration(db => { | |
db.ConnectionStringName = "MyConnection"; | |
db.Dialect<MsSql2008Dialect>(); | |
db.Driver<ProfiledSql2008ClientDriver>(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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