Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

More NHibernate tests #3

Merged
merged 1 commit into from

2 participants

@mcliment

If you find them interesting, I added NHibernate Criteria and LINQ tests. I tested them to check that the queries are correct.

@SamSaffron SamSaffron merged commit 6ddf029 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 5, 2011
  1. @mcliment
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 0 deletions.
  1. +12 −0 Tests/PerformanceTests.cs
View
12 Tests/PerformanceTests.cs
@@ -7,6 +7,8 @@
using BLToolkit.Data;
using Dapper;
using Massive;
+using NHibernate.Criterion;
+using NHibernate.Linq;
using SqlMapper.Linq2Sql;
using SqlMapper.NHibernate;
@@ -145,6 +147,16 @@ public void Run(int iterations)
.SetInt32("id", id)
.List(), "NHibernate HQL");
+ var nhSession3 = NHibernateHelper.OpenSession();
+ tests.Add(id => nhSession3.CreateCriteria<Post>()
+ .Add(Restrictions.IdEq(id))
+ .List(), "NHibernate Criteria");
+
+ var nhSession4 = NHibernateHelper.OpenSession();
+ tests.Add(id => nhSession4
+ .Query<Post>()
+ .Where(p => p.Id == id).ToList(), "NHibernate LINQ");
+
// bltoolkit
var db1 = new DbManager(Program.GetOpenConnection());
tests.Add(id => db1.SetCommand("select * from Posts where Id = @id", db1.Parameter("id", id)).ExecuteList<Post>(), "BLToolkit");
Something went wrong with that request. Please try again.