DataPortal globalContext

DataPortal globalContext

Old forum URL: forums.lhotka.net/forums/t/619.aspx


RRorije posted on Friday, July 14, 2006

Hi there,

This CSLA framework is really cool.

Yet I have a problem with data that must be available on both dataPortal and client. Maybe this question has come up before, but I haven't found the solution yet. I would like to know how you handle this.

During the application I set the global context,

ApplicationContext.GlobalContext.Add(GlobalData.NAME, appData)

with some properties I need to have on both sides of the program. But it seems that the server will not remember these. Especially when I create a new thread on the dataportal, all the information seems lost.

I have not found a way around, to ensure that the properties are allways known at the server side.

I hope you can help me.

P.S. The version of CSLA that I use, (might be helpful) is 1.5

ajj3085 replied on Friday, July 14, 2006

Ahh, you're using threads.

The problem is that the GlobalContext stores its information in ThreadLocalStorage, so that when you create a new thread, it doesn't have this data (ThreadLocalStorage is private to each thread).

The ClientContext IS accessable from all threads, but don't 'refresh' with data from the data portal automatically. 

This is just a limitation of threads and Csla.

See http://forums.lhotka.net/forums/thread/908.aspx for more information.


HTH
Andy

RRorije replied on Friday, July 14, 2006

Thank you very much I will look into it.


Copyright (c) Marimer LLC