Lately I have been seeing posts with regards to filtered searching inside of the SalesLogix web client. An example is the contact list where functionality is required to display only the contacts with a certain last name. I had to do this recently and had found the same issues that had been reported in the forums and newsgroups. The problem identified that properties in child entities were not resolvable when bound to a grid. After some head scratching, and inspection using visual studio debugger I noticed that the children were not being resolved (lazy loading) so I wrote a simple method to explicitly unwrap the entity to ensure that the children are resolved.

The simple helper method is as follows

static Sage.SalesLogix.Orm.EntityBase Unwrap(Sage.SalesLogix.Orm.EntityBase value)
   INHibernateProxy proxy = value as INHibernateProxy;
   if (proxy != null)
      value = (Sage.SalesLogix.Orm.EntityBase)

   return value;
Now I will finally iterate through the resultant list in my query and add the result of this method call to a new list and finally return this new list instead of the one that was directly returned from the query.

var list = (IList)queryExecutor.List<IContact>(); // Gets the list from NHibernate

// New resultant list

IList result = new List<IContact>(); 


// Unwrap the entities and add to the new list

foreach (IContact contact in list)




return result;


— Mark

1 Comment

Leave a Reply