NHibernate

· February 15, 2007

OK - it is now official. I am in love!

For sometime now i have had some ideas that the Hibernate framework is cool, but i have not seen it in action. But now I have and it is wonderful… so nice and cool.

The Hibernate framework solves the tedious work of mapping your objects in C# (or Java as it is originally) to tables in the database. This is accomplished through mapping files in XML, so it is easy to maintain over time.

It’s so clean and reduce the database coding to a mere minimum. Also this will make you focus on the right stuff, such as business logic.

I am still a rookie (just playing around with it for a short while yet) but this will be my melody from now. Here is some code lines that convinced me: // Open a new session to retrieve the just saved user session = factory.OpenSession(); User joeUser = (session.Load(typeof(User), "[id]") as User); // Update a property joeUser.LastLogon = DateTime.Now; // Flush the changes back session.Flush();

// The database is now updated!!!

Twitter, Facebook