Monday 26 November 2007

Databinding NHibernate

Had a few problems data-binding lists returned from NHibernate (queries or collections) where the first object in the list was a proxy. We previously 'fixed' this by clearing the session prior to running the query. This then caused further problems as objects were detached and the lazy-lists threw exceptions.

The solution we came to is based on : This posting by Ayende

A TypeDescriptor was created for EntityBase (all our objects returned from NHibernate inherit from EntityBase) which was registered with the web-site in the Global.asax Application_StartUp.

Thursday 22 November 2007

Configuration Error: FairmortRoleProvider

When creating a new site we kept getting spurious errors which seemed to relate to "add name=FairmortRoleProvider...." line of Web.Config.

This was a red herring and the actual error related to Spring Config files and references.  The Salecore assemblies that are to be referenced must be added as a reference AND the relevant config files also added. Either missing reference or config file can cause this spurious error.