//-- defined in page not compatible with others. Since we unable to
//-- override this behavour (private methods), workaround is to
//-- dispose BO instance at session before SF initialize BO.
//-------------------------------------------------
//-- Dispose BO instance in session which used in
//-- this page to avoid "conflict" with other page
//-------------------------------------------------
if (!this.Page.IsPostBack && !this.Page.IsCallback)
{
//this.RemoveUnusedBusinessObjectsFromSession();
this.RemoveBusinessObjectsInstanceFromSession();
}
base.OnPreLoad(e);
}
private void RemoveBusinessObjectsInstanceFromSession()
{
string businessObjectName = string.Empty;
BusinessLayer businessObject;
PropertyInfo[] propertyInfos = GetBusinessObjectInfosEx();
foreach (PropertyInfo propInfo in propertyInfos)
{
businessObjectName = propInfo.Name;
businessObject = SessionManager.Instance.Get<BusinessLayer>(businessObjectName);
if (businessObject != null)
{
businessObject.Dispose();
businessObject = null;
SessionManager.Instance.Set(businessObjectName, null);