Peter Morlion logo

How to use NHibernate’s SQLCriterion – take 2

After having an interesting discussion with Stefaan (colleague, friend, ex-colleague and now colleague again) about my previous post on NHibernate’s SQLCriterion, I decided to have another look at my usage of SQLCriterion. He argued that with SQLCriterion, you’re more or less working around the ORM, which I can agree with. After putting it on StackOverflow, […]

How to use NHibernate’s SQLCriterion

I recently needed to use NHibernate’s SQLCriterion, but lost some time on finding out how to use it. Once you’ve found it, it’s quite simple actually: ISessionFactory sessionFactory = GetSessionFactory(); ISession session = sessionFactory.GetCurrentSession(); ICriteria criteria = session.CreateCriteria(); var sqlString = new SqlString(“{alias}.GroupId = ” + groupId); criteria.Add(new SQLCriterion(sqlString, new object[0], new IType[0])); return criteria.List(); […]

Switching from NHibernate to RavenDB

In my previous post, I explained how I went about starting with RavenDB. Now I want to continue my switch from NHibernate to RavenDB. The GetAll method was fairly simple. I also have a GetOneById method in my BaseRepository, but, as I’m not using it right now, I decided to remove it (YAGNI you know). […]

Starting up RavenDB with .NET 3.5

The application I’m writing isn’t in a very far stadium yet, but I do have some implementation of repositories using NHibernate. Now I want to switch to RavenDB. So I downloaded RavenDB (the latest build at this time – build 81) and unzipped it. I wanted to follow the RavenDB Hello World tutorial, but soon […]

WPF, NHibernate and the Model-View-ViewModel design pattern (MVVM)

WPF creates a whole new range of possibilities, but you can often run into trouble when trying to combine it with NHibernate. NHibernate can’t handle ObservableCollections*, which is a quite handy feature of WPF. Furthermore, what to do with the good databinding capabilities of WPF?Shawn Duggan provides a nice solution using the **Model-View-ViewModel **pattern here. […]

NHibernate Intellisense for Visual Studio 2008

Want intellisense for NHibernate in Visual Studio 2008? It’s easy, just download the NHibernate source here, and extract it somewhere. Go to the src/NHibernate folder and copy the following files: nhibernate-configuration.xsd nhibernate-mapping.xsd nhibernate-generic.xsdPaste these files in the Xml/Schemas folder of your VS2008 installation folder. Usually this will be C:\Program Files\Microsoft Visual Studio 9.0\Xml\Schemas.