diff --git a/.gitignore b/.gitignore index a7d31be..47af8c5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,44 @@ -obj +# Visual Studio artifacts bin -packages +obj +release +debug +obj/* +bin/* +release/* +debug/* +.svn +*.tmp +*.user *.suo -*.user \ No newline at end of file +*.vsp +*.csproj.VisualState.xml +*.exe +*.pdb +*.vspscc +*.vssscc +*.Publish.xml +*.cache +*.dgml +packages +packages/* +.nuget +.nuget/* + +# NUnit artifacts +TestResult.xml + +# Resharper artifacts +_ReSharper.* +*.resharper + +# Nupkg artifacts +*.nupkg + +# Tests +*.testsettings +*.vsmdi +*.testsettings + +# ncrunch +*.ncrunchsolution \ No newline at end of file diff --git a/MiniProfiler.NHibernate/Drivers/Oracle/MiniProfilerOracle10ClientDriver.cs b/MiniProfiler.NHibernate/Drivers/Oracle/MiniProfilerOracle10ClientDriver.cs new file mode 100644 index 0000000..bcb9f3e --- /dev/null +++ b/MiniProfiler.NHibernate/Drivers/Oracle/MiniProfilerOracle10ClientDriver.cs @@ -0,0 +1,28 @@ +using System; +using System.Data; +using System.Data.Common; +using System.Data.OracleClient; +using NHibernate.AdoNet; +using NHibernate.Driver; +using StackExchange.Profiling.NHibernate.Infrastructure; + +namespace StackExchange.Profiling.NHibernate.Drivers.Oracle +{ + public class MiniProfilerOracle10ClientDriver : OracleClientDriver, IEmbeddedBatcherFactoryProvider + { + public override IDbCommand CreateCommand() + { + var command = base.CreateCommand(); + + if (MiniProfiler.Current != null) + command = new ProfiledGenericDbCommand((DbCommand)command, MiniProfiler.Current); + + return command; + } + + Type IEmbeddedBatcherFactoryProvider.BatcherFactoryClass + { + get { return typeof(OracleDataClientBatchingBatcherFactory); } + } + } +} \ No newline at end of file diff --git a/MiniProfiler.NHibernate/Drivers/MiniProfilerSql2008ClientDriver.cs b/MiniProfiler.NHibernate/Drivers/SQLServer/MiniProfilerSql2008ClientDriver.cs similarity index 76% rename from MiniProfiler.NHibernate/Drivers/MiniProfilerSql2008ClientDriver.cs rename to MiniProfiler.NHibernate/Drivers/SQLServer/MiniProfilerSql2008ClientDriver.cs index 2a8f270..8b89c39 100644 --- a/MiniProfiler.NHibernate/Drivers/MiniProfilerSql2008ClientDriver.cs +++ b/MiniProfiler.NHibernate/Drivers/SQLServer/MiniProfilerSql2008ClientDriver.cs @@ -1,27 +1,28 @@ -using System; -using System.Data; -using System.Data.Common; -using NHibernate.AdoNet; -using NHibernate.Driver; -using StackExchange.Profiling.NHibernate.Infrastructure; - -namespace StackExchange.Profiling.NHibernate.Drivers -{ - public class MiniProfilerSql2008ClientDriver : Sql2008ClientDriver, IEmbeddedBatcherFactoryProvider - { - public override IDbCommand CreateCommand() - { - var command = base.CreateCommand(); - - if (MiniProfiler.Current != null) - command = new ProfiledSqlDbCommand((DbCommand)command, MiniProfiler.Current); - - return command; - } - - Type IEmbeddedBatcherFactoryProvider.BatcherFactoryClass - { - get { return typeof(ProfiledSqlClientBatchingBatcherFactory); } - } - } +using System; +using System.Data; +using System.Data.Common; +using System.Data.SqlClient; +using NHibernate.AdoNet; +using NHibernate.Driver; +using StackExchange.Profiling.NHibernate.Infrastructure; + +namespace StackExchange.Profiling.NHibernate.Drivers.SQLServer +{ + public class MiniProfilerSql2008ClientDriver : Sql2008ClientDriver, IEmbeddedBatcherFactoryProvider + { + public override IDbCommand CreateCommand() + { + var command = base.CreateCommand(); + + if (MiniProfiler.Current != null) + command = new ProfiledGenericDbCommand((DbCommand)command, MiniProfiler.Current); + + return command; + } + + Type IEmbeddedBatcherFactoryProvider.BatcherFactoryClass + { + get { return typeof(ProfiledSqlClientBatchingBatcherFactory); } + } + } } \ No newline at end of file diff --git a/MiniProfiler.NHibernate/Infrastructure/ProfiledGenericDbCommand.cs b/MiniProfiler.NHibernate/Infrastructure/ProfiledGenericDbCommand.cs new file mode 100644 index 0000000..6a1404a --- /dev/null +++ b/MiniProfiler.NHibernate/Infrastructure/ProfiledGenericDbCommand.cs @@ -0,0 +1,22 @@ +using System.Data.Common; +using StackExchange.Profiling.Data; + +namespace StackExchange.Profiling.NHibernate.Infrastructure +{ + internal class ProfiledGenericDbCommand : ProfiledDbCommand + where T : DbCommand + { + private readonly T _command; + + public ProfiledGenericDbCommand(DbCommand command, IDbProfiler profiler) + : base(command, null, profiler) + { + _command = (T)command; + } + + public T Command + { + get { return _command; } + } + } +} \ No newline at end of file diff --git a/MiniProfiler.NHibernate/Infrastructure/ProfiledSqlClientBatchingBatcher.cs b/MiniProfiler.NHibernate/Infrastructure/ProfiledSqlClientBatchingBatcher.cs index 75257d5..3f2bdd4 100644 --- a/MiniProfiler.NHibernate/Infrastructure/ProfiledSqlClientBatchingBatcher.cs +++ b/MiniProfiler.NHibernate/Infrastructure/ProfiledSqlClientBatchingBatcher.cs @@ -55,10 +55,10 @@ public override void AddToBatch(IExpectation expectation) .AppendLine(lineWithParameters); } - var update = batchUpdate as ProfiledSqlDbCommand; + var update = batchUpdate as ProfiledGenericDbCommand; if (update != null) { - _currentBatch.Append(update.SqlCommand); + _currentBatch.Append(update.Command); } else { diff --git a/MiniProfiler.NHibernate/Infrastructure/ProfiledSqlDbCommand.cs b/MiniProfiler.NHibernate/Infrastructure/ProfiledSqlDbCommand.cs index 3983f64..98285bb 100644 --- a/MiniProfiler.NHibernate/Infrastructure/ProfiledSqlDbCommand.cs +++ b/MiniProfiler.NHibernate/Infrastructure/ProfiledSqlDbCommand.cs @@ -1,9 +1,11 @@ -using System.Data.Common; +using System; +using System.Data.Common; using System.Data.SqlClient; using StackExchange.Profiling.Data; namespace StackExchange.Profiling.NHibernate.Infrastructure { + [Obsolete] internal class ProfiledSqlDbCommand : ProfiledDbCommand { private readonly SqlCommand _sqlCommand; diff --git a/MiniProfiler.NHibernate/MiniProfiler.NHibernate.csproj b/MiniProfiler.NHibernate/MiniProfiler.NHibernate.csproj index 1564264..3d3f38c 100644 --- a/MiniProfiler.NHibernate/MiniProfiler.NHibernate.csproj +++ b/MiniProfiler.NHibernate/MiniProfiler.NHibernate.csproj @@ -44,6 +44,7 @@ + @@ -51,7 +52,9 @@ - + + + @@ -60,6 +63,7 @@ +