Category Archives: NHibernate

HttpApplication EndRequest Event Invoked Many Times In Single Request?

The other day I was putting the last touch of a temporary way to manage the NHibernate session (ISession) in Bunian. So part of the task was to bind a method to the HttpApplication EndRequest event (in the Global.asax.cs file) like the following: public override void Init() {        this.EndRequest += WorkContext.NHibernateSessionManager.Instance.HttpRequestEnded; } By doing… Read More »

Introduction to NHibernate Session at Jordev Was Good

The feedback was very good, and I was glad that everybody liked it. Jordev is really moving ahead, and I am very excited being part of it 🙂 Below is the slide show (it’s an enhanced version from my previous one): [slideshare id=821222&doc=introductiontonhibernate-1228487480885456-9&w=425] Code is the same of the previous one which you can download… Read More »

NHibernate possible bug in IQuery.List<T>()

recently, we had to clean the database from all the testing data, when an error similar to the following appeared: The value “” is not of type “System.Nullable`1[System.DateTime]” and cannot be used in this generic collection The code I executed was:             IQuery query = DbManager.MySession.CreateQuery(“select max(dateObject.EndDate) from DateDomain dateObject”);             IList<DateTime?> list = query.List<DateTime?>();… Read More »

Columns’ case-sensitivity in NHibernate

The other day I wanted to create an HQL query to retrieve data from one object (WorkOrderFault) that has many-to-many relation with another. so I created the following: ISession session = NHibernateOrmSessionFactory.CurrentNHibernateSession; IQuery query = session.CreateQuery(    “select wof from WorkOrderFault wof join wof.WorkOrderTechnicians as tech where tech.Id = 43334”); IList<WorkOrderFault> objects = query.List<WorkOrderFault>(); The query… Read More »