diff --git a/NHibernate/Iesi.Collections.dll b/NHibernate/Iesi.Collections.dll
new file mode 100644
index 00000000..848ca527
Binary files /dev/null and b/NHibernate/Iesi.Collections.dll differ
diff --git a/NHibernate/LinFu.DynamicProxy.dll b/NHibernate/LinFu.DynamicProxy.dll
new file mode 100644
index 00000000..8cc3fad8
Binary files /dev/null and b/NHibernate/LinFu.DynamicProxy.dll differ
diff --git a/NHibernate/NHibernate.ByteCode.LinFu.dll b/NHibernate/NHibernate.ByteCode.LinFu.dll
new file mode 100644
index 00000000..b37dbbea
Binary files /dev/null and b/NHibernate/NHibernate.ByteCode.LinFu.dll differ
diff --git a/NHibernate/NHibernate.dll b/NHibernate/NHibernate.dll
new file mode 100644
index 00000000..21232aaa
Binary files /dev/null and b/NHibernate/NHibernate.dll differ
diff --git a/NHibernate/NHibernateHelper.cs b/NHibernate/NHibernateHelper.cs
new file mode 100644
index 00000000..8ef7228e
--- /dev/null
+++ b/NHibernate/NHibernateHelper.cs
@@ -0,0 +1,33 @@
+using System.Data;
+using NHibernate;
+using NHibernate.Cfg;
+
+namespace SqlMapper.NHibernate
+{
+ public class NHibernateHelper
+ {
+ private static ISessionFactory _sessionFactory;
+
+ private static ISessionFactory SessionFactory
+ {
+ get
+ {
+ if (_sessionFactory == null)
+ {
+ var configuration = new Configuration();
+ configuration.Configure(@"..\..\NHibernate\hibernate.cfg.xml");
+ configuration.AddAssembly(typeof(Post).Assembly);
+ configuration.AddXmlFile(@"..\..\NHibernate\Post.hbm.xml");
+ _sessionFactory = configuration.BuildSessionFactory();
+ }
+
+ return _sessionFactory;
+ }
+ }
+
+ public static ISession OpenSession()
+ {
+ return SessionFactory.OpenSession();
+ }
+ }
+}
diff --git a/NHibernate/Post.hbm.xml b/NHibernate/Post.hbm.xml
new file mode 100644
index 00000000..d3825215
--- /dev/null
+++ b/NHibernate/Post.hbm.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/NHibernate/hibernate.cfg.xml b/NHibernate/hibernate.cfg.xml
new file mode 100644
index 00000000..ffede3ba
--- /dev/null
+++ b/NHibernate/hibernate.cfg.xml
@@ -0,0 +1,12 @@
+
+
+
+ NHibernate.Connection.DriverConnectionProvider
+ NHibernate.Dialect.MsSql2005Dialect
+ NHibernate.Driver.SqlClientDriver
+ Smackdown.Properties.Settings.tempdbConnectionString
+ NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu
+ false
+ false
+
+
\ No newline at end of file
diff --git a/PerformanceTests.cs b/PerformanceTests.cs
index 3d366de9..ca06630b 100644
--- a/PerformanceTests.cs
+++ b/PerformanceTests.cs
@@ -7,6 +7,7 @@ using SqlMapper.Linq2Sql;
using System.Data.Linq;
using System.Diagnostics;
using Massive;
+using SqlMapper.NHibernate;
namespace SqlMapper
{
@@ -118,7 +119,22 @@ namespace SqlMapper
SubSonic.tempdbDB db=new SubSonic.tempdbDB();
tests.Add(id => new SubSonic.Query.CodingHorror(db.Provider, "select * from Posts where Id = @0", id).ExecuteTypedList(), "SubSonic Coding Horror");
- // HAND CODED
+ // NHibernate
+
+ var nhSession1 = NHibernateHelper.OpenSession();
+ tests.Add(id => nhSession1.CreateSQLQuery(@"select * from Posts where Id = :id")
+ .SetInt32("id", id)
+ .List(), "NHibernate SQL");
+
+
+ var nhSession2 = NHibernateHelper.OpenSession();
+ tests.Add(id => nhSession2.CreateQuery(@"from Post as p where p.Id = :id")
+ .SetInt32("id", id)
+ .List(), "NHibernate HQL");
+
+
+
+ // HAND CODED
var connection = Program.GetOpenConnection();
diff --git a/PerformanceTests.cs.rej b/PerformanceTests.cs.rej
new file mode 100644
index 00000000..e0d1d1f7
--- /dev/null
+++ b/PerformanceTests.cs.rej
@@ -0,0 +1,38 @@
+--- PerformanceTests.cs
++++ PerformanceTests.cs
+@@ -1,13 +1,13 @@
+ using System;
+ using System.Collections.Generic;
++using System.Data.Linq;
++using System.Data.SqlClient;
++using System.Diagnostics;
+ using System.Linq;
+-using System.Text;
+-using System.Data.SqlClient;
+-using SqlMapper.Linq2Sql;
+-using System.Data.Linq;
+-using System.Diagnostics;
+ using Massive;
+ using Simple.Data;
++using SqlMapper.Linq2Sql;
++using SqlMapper.NHibernate;
+
+ namespace SqlMapper
+ {
+@@ -113,6 +113,16 @@
+ var simpleDataDb5 = Database.OpenConnection(Program.connectionString);
+ tests.Add(id => simpleDataDb5.Posts.FindAllById(id).ToList(), "Simple.Data FindAllBy ToList");
+
++ var nhSession1 = NHibernateHelper.OpenSession();
++ tests.Add(id => nhSession1.CreateSQLQuery(@"select * from Posts where Id = :id")
++ .SetInt32("id", id)
++ .List(), "NHibernate SQL");
++
++ var nhSession2 = NHibernateHelper.OpenSession();
++ tests.Add(id => nhSession2.CreateQuery(@"from Post as p where p.Id = :id")
++ .SetInt32("id", id)
++ .List(), "NHibernate HQL");
++
+ // HAND CODED
+ var connection = Program.GetOpenConnection();
+
diff --git a/Program.cs b/Program.cs
index df5b70b2..669fec97 100644
--- a/Program.cs
+++ b/Program.cs
@@ -51,12 +51,12 @@ namespace SqlMapper
static void Main(string[] args)
{
-#if DEBUG
- RunTests();
-#else
+//#if DEBUG
+ // RunTests();
+//#else
EnsureDBSetup();
RunPerformanceTests();
-#endif
+//#endif
Console.ReadKey();
}
diff --git a/Program.cs.rej b/Program.cs.rej
new file mode 100644
index 00000000..88ae5290
--- /dev/null
+++ b/Program.cs.rej
@@ -0,0 +1,11 @@
+--- Program.cs
++++ Program.cs
+@@ -32,7 +32,7 @@
+ class Program
+ {
+
+- public static readonly string connectionString = @"Data Source=.\sql2k8r2;Initial Catalog=tempdb;Integrated Security=True";
++ public static readonly string connectionString = @"Data Source=.;Initial Catalog=tempdb;Integrated Security=True";
+
+ public static SqlConnection GetOpenConnection()
+ {
diff --git a/SqlMapper.csproj b/SqlMapper.csproj
index 40af7a54..8dd1c833 100644
--- a/SqlMapper.csproj
+++ b/SqlMapper.csproj
@@ -35,6 +35,18 @@
4
+
+ NHibernate\Iesi.Collections.dll
+
+
+ NHibernate\LinFu.DynamicProxy.dll
+
+
+ NHibernate\NHibernate.dll
+
+
+ NHibernate\NHibernate.ByteCode.LinFu.dll
+
SubSonic\SubSonic.Core.dll
@@ -64,6 +76,7 @@
+
@@ -139,7 +152,10 @@
DataClasses.dbml
-
+
+
+
+