Monthly Archives: February 2013

Asp.Net & ORM Tool NHibernate For Dummy Tutorial – Update & Delete Operation

NHibernate is a open source Object-Relational Mapping (ORM) tool. This ORM tool hides sql query complexities by replacing query with mapping and class object.

I already have article about basic NHibernate in previous post. If you are new to Nhibernate then I recommend to Click here Asp.Net & ORM Tool NHibernate For Dummy Tutorial – Select & Insert Operation first.

Lets recap what we have to do to work with NHibernate.

  1. Download necessary NHibernate file including NHibernate.dll & configuration template/example at http://sourceforge.net/projects/nhibernate
  2. Create xml mapping file and a class which representates DB table
  3. Include Nhibernate dll file, NHibernate xml configuration file, class library (if you have separate class project), and Asp.Net file it self
  4. Write codes inside the Asp.Net file that contains NHibernate configuration class object initialization, AddAssembly to Class Library, BuildSessionFactory, OpenSession, BeginTransaction, SaveOrUpdate, Commit to save data to DB.
  5. Write SQL Query replacement with QueryOver<T>() method and Where filter (if necessary) that has LinQ like syntax to retrieve record(s) and automatically convert to a class

Continue reading