Showing posts with label ORM. Show all posts
Showing posts with label ORM. Show all posts

Saturday, November 8

Long Running Conversation with NHibernate

I am implementing a Windows Application which use WPF for presentation layer and NHibernate for O/R mapping. Off course I'm diving the application for MVC or more accurately Model/View/ViewModel due to the use of WPF.
I have been reding the book "NHibernate In Action" to try and learn how to use NHibernate in a good practice sort of way.
I have fail to find good documentation which explain how to use NHibernate in Windows Application, and more specifically how to create a separation  to layers including NHibernate (how NHibernate incorporate to MVC design pattern).

So, I've ask that question in the forum of the book and got an answer.
You are welcome to read the thread and I'll keep on update here as I'll implement the solution.

Monday, August 25

NHibernate

I've start to work on a new project.
One of the base building blocks of that project is something we call "bank".
Bank can be anything from simple list of items (which maps to simple table in a database) to a complex network of objects like tree for example (which maps to several tables with relation in a database).

I've start to write some sample code to see how I can solve this problem. I've worked for a week just to produce a solution to loading a bank from a database tables. I've not yet got to saving the bank back to the database.

Then, after talking to a friend about this problem, I've got to learn about NHibernate.
After few hours of reading the getting reference document and searching the web I've got a solution for both loading and saving virtually any form of bank to and from a database tables.

I have to say I am amaze from the easy of use and the abilities NHibernate has. All the plumbing of tracking the objects state (loaded, modified, delete) are now in the hand of NHibernate, yet I can "plug" into the process using various plug-in points left by the developers of NHibernate to observe or participate in the process of loading and saving the objects.

Next time I'll write about "dynamic bank" - how to let the user define bank without the need to create database table.