Custom objects stored in session?

Aug 9, 2011 at 2:08 PM

A little confused on how to store my custom business objects in the session so that I can share and access them across hosted controls.

I've been researching context, but there doesnt seem to be a way to insert an entire object without parsing out each property into its own seperate name/value pair. Am I missing something?

Aug 10, 2011 at 4:41 AM
Edited Aug 10, 2011 at 4:46 AM

Context is for “Key” data, meaning data that is stored with the session that can be quickly accessed.
its not intended to store lots of data, only data that is required to be seen by all consuming controls or adapters.

How you store you own object really depends on your application needs.
There are several ways to to do it, Here are the 3 basic patterns you can use.

Is the object something that you want to store with the “Customer” object on the session?
if so, You would define it as part of the customerdatapayload object handed into the ReturnSearchResult or CreateSession Method inside the CustomerData Object.
This is useful if you need to use it during Session create, or want to serialize it with the session for storage.

Is the object you are trying to store related to specific role, or business process? Does it need to have global scope?
if so, you want to define it in a Hosted control that is Hidden and Register it with AIFServices, using an Interface to access it. Then from any hosted control or adapter use AIFServices to pull it out.

Is the object something that you want to Limit access to only things that “know” about it?
in that case, you want to use a hidden hosted control again, and a use a custom interface for the provider, and another interface for the Consumer, which you would pick up and wire in the LoadUserDefinedGlobalApps area of UII Services, then assign it to your hosted controls in the following overrides:

This will only allow it to be “wired” by controls that have the Consumer Interface.


Probably should do a blog post with examples on this at some point as it’s a common question when I talk to folks in person J