Archive of NHibernate

Lazy column loading with NHibernate

Posted by Kevin McKelvin on March 15, 2011 in NHibernate

Lets take a look at the following simple schema, for brevity’s sake I’ll just use three entities. Product + Id int + Description string + BasePrice decimal + Image byte[] Order + Id int + Lines ICollection<OrderLine> + ShippingAddress string OrderLine + Id int + Customer Customer + Product Product + LinePrice decimal + Qty int From a conceptual point of view it’s great, we have a nice easy object graph to traverse and it’s pretty discoverable as well. However lets look at it from a SQL point of view.  If I were to

Continue ReadingLeave a Comment

NHibernate 3.1GA Released

Posted by Kevin McKelvin on March 12, 2011 in NHibernate

Fabio Maulo’s put up the NHibernate 3.1GA release on www.nhforge.org. So far I’ve upgraded my code with minimal issues. Here are the release notes:

Continue ReadingLeave a Comment

Minimalist NHibernate 3 Loquacious Configuration

Posted by Kevin McKelvin on August 15, 2010 in NHibernate

In NHibernate 3, they’ve brought in the Loquacious API to eliminate some of the XML burdens of NHibernate. In most cases, the configuration of the ISessionFactory remains static between development and release.  Of course anything that changes can be brought in via the App.config file. This requires a connection string to be added to your App.config called DataConnection.

Continue ReadingView Comments (3)

NHibernate XML Mappings – Part 2 – Mapping the Product

Posted by Kevin McKelvin on June 15, 2010 in .NET, NHibernate

Continuing where we left off from part 1, we had created a class library called DomainModel and created four classes to act as data transfer objects. In this part we’ll create our first NHibernate mapping for the Product entity. Lets revisit what our Product class looks like first. We have three properties which we want to map to our columns in the database.  NHibernate does this using XML files. Quick tip: Make sure you’ve brought the nhibernate-configuration.xsd and nhibernate-mapping.xsd files into your solution.  They are in the NHibernate redistributable you would hav

Continue ReadingLeave a Comment