StrataFrame Forum

Removed unused BO from session

http://forum.strataframe.net/Topic28553.aspx

By ChanKK - 9/30/2010

Hi,
As SF's web page create and store BO instance at session. Anyway to remove unused BO instance without need to wait till session timeout?

For example, when navigate to Form A, it uses BOA, BOB and BOC,
when navigate to FormB, it uses BOX, BOY and BOZ.

My question is, since BOA, BOB and BOC no longer needed, how to clear them?
I was thinking to override SF Base Page and add prefix to BO session name. Before InitializeBusinessObject and NOT postback, remove all BOs from session which its session name with prefix as desired. However, it might not works as end user might open more than one page at the same time (FormA and Form in 2 browser tabs).

Any advice?

Thank you
By Trent L. Taylor - 10/7/2010

Well, you can remove the BOs from the session as they are just stored in the session with the name of the property:

public MyBo Business1{.....}


In the above example, the Session variable should be Session["Business1"].  However, this can be dangerous as the BasePage will be expecting them and will ultimately take the logic out of the framework and place it in your hands as to make sure that these sessions get restored.
By ChanKK - 10/18/2010

Hi
The problem is, I don't know when to release it.. because I am not sure if it is still in used by other page... or just hanging... unless session expired