Querying Over Multiple Child Collections With NHibernate

Typically with NHibernate, I’m always querying over one table and eager fetching it’s child collections. I’m also only performing WHERE conditions on that initial table I am querying over.

The other day though, I needed to solve a problem where I was adding WHERE conditions to the child collections. Now in SQL, this is quite easy but in NHibernate, it took me a while to figure out how to do this efficiently.

Continue reading

Explicitly Specifying the Identity Column Value using Fluent NHibernate

I recently ran into a situation where I was saving to a database table that did not have an auto-incrementing identity column. I didn’t realize that at the time when I was setting up my NHibernate mapping and it caused me a headache for about half an hour attempting to figure out what was causing the problem.

Continue reading