>>I create a Session object ( say it has datasession 5). I then call a method of the session object which creates an custom object and returns it.
>>The returned object will have datasession 5
>
>IOW, it's a factory which is a session. My problem was that I had a global factory which would always create objects in DS 1 (so all of their code would run there and DS switching was often necessary) - so instead I had to create a factory in each DS. Your solution attacks the problem from the opposite direction. I like that - both the factory and datasession need to be created early on, to create other objects or at least the environment for them, so why not make them one class. Nice :).
In the factory pattern do you release the object that manages the factory before child objects are released?
If it's not broken, fix it until it is.
My Blog