🇵🇸 Call for a #CeasefireNOW 🇵🇸

Act Now

A Case We Shouldn’t Use Stored Procedure’s In

We are working on this big project at work in which several teams are assigned to different modules. The modules are, naturally, overlapping in certain areas where they they need to interact with each other through API’s. One of these modules is central and crucial to the rest of the modules, the dependency is very high that the team has to provide many API’s. Certain API’s was needed by different modules; our team needed a list of entity X, and another team also wanted a list of entity X, BUT…we had different criteria! ...

June 9, 2009 Â· Emad Alashi

Importance of Documentation

 Lately we have decided in Bunian to move on to NHibernate 2.0, and the contributor assigned to the move started out, only to send an email one day after: “THERE IS NO DOCUMENTATION!’. We had errors as a result to the move which couldn’t be fixed without a documentation explaining why this happened. After searching for a while, we found two resources of the new documentation: a wiki help that is hosted on Google Knol: http://knol.google.com/k/fabio-maulo/-/1nr4enxv3dpeq/21# Not really appealing to be used extensively; no smooth flow between chapters, frames dazzle the eyes, no table of contents, but surely a great step forward for a documentation that is maintained by the community ...

December 26, 2008 Â· Emad Alashi

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 this, at the end of each page request the NHibernateSessionManager.Instance.HttpRequestEnded() will be called and I can clean the session then. But to my surprise this method was called at least 10 times!! So I thought maybe the Global.Init() method is called many times for some reason and I ended up binding the same method to the EndRequest event many times, so I set a breakpoint at the Global.Init() method and…it’s called one time only. ...

December 14, 2008 Â· Emad Alashi

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): Introduction To NHibernate (SlideShare) Code is the same of the previous one which you can download from here

December 5, 2008 Â· Emad Alashi

My First Talk at JorDev .net

JorDev .net is a .NET user group founded by enthusiastic Jordanian IT professionals. On Wednesday, November 26, I will be doing my first session in a series about NHibernate. Talk Details Overview: NHibernate is an object-relational mapping (ORM) solution for the Microsoft .NET platform. It provides an easy-to-use framework for mapping an object-oriented domain model to a traditional relational database. Its purpose is to relieve the developer from a significant amount of relational data persistence-related programming tasks. NHibernate is free open source software distributed under the GNU Lesser General Public License. Target audience: .NET developers, software designers, software engineers, and software architects. Date: Wednesday, November 26, 2008. Location: MIC (Microsoft Innovation Center, Royal Scientific Society Building, 3rd Floor). Time: 6:30 pm to 8:30 pm (Amman, Jordan local time). For more info: Mohamed Saleh: 0788716457 Ayman Farouk: 0795727344 Reminders Live Calendar Facebook event Outlook Calendar Google Calendar

November 21, 2008 Â· Emad Alashi

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?>(); When I debugged NHibernate code, I reached to the following AddAll() method in the ArrayHelper class: // NH-specific public static void AddAll(IList to, IList from) { foreach (object obj in from) { to.Add(obj); } } You can find the explanation of the error here. Which brings us to the interesting question: why the implementation of IList Add method doesn’t consider the “nullability” of the T object? and why the parameter is of type IList?! ...

September 21, 2008 Â· Emad Alashi

NHibernate Inverse attribute

I had to read documentation, articles, many blog entries and go into discussions with colleagues… all to get the root of this ambiguous attribute of NHibernate, it is trickey! This blog entry is another trial to explain the attribute, but with taking one more detailed step into the explanation. NHibernate is meant to persist objects as well as to manage their relations to each other, lets take a look at the following example of Parent and Child classes: ...

August 22, 2008 Â· Emad Alashi

Mapping Enumeration of type int in NHibernate

I wanted to map an integer enumeration type in NHibernate, I googled “mapping enumeration in NHibernate” and the best explanation was of Jeremy Miller in his post here. But as it appears (and according to my understanding) that the enumeration type should be mapped to a database column of characters type (varchar, char,…etc). What if the database column was int? well…do exactly like what jeremy did except simply use “NHibernate.Type.PersistentEnumType” instead of “NHibernate.Type.EnumStringType“. ...

August 19, 2008 Â· Emad Alashi

My “Introduction to NHibernate” presentation and slides

I have delivered the presentation I talked about in my previous post here. Actually it was pretty simple and straightforward, the slides them selves don’t have code content; all the code was shown in VS directly (I always found it better to see the code in its really environment to better understand). The attendees were handful, but if felt really great when they expressed how excited they were about the whole thing. ...

July 2, 2008 Â· Emad Alashi

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 ran successfully, and I got my results. Then I wanted to use paging and get certain amount of results starting from certain record, so I added these two lines directly after I instantiated the IQuery object: ...

June 28, 2008 Â· Emad Alashi