Hi,
I’m currently working on a WPF application where we use the CSLA (2.1.3) framework.
I stumbled on a frustrating issue. From time to time our Csla.ApplicationContext.User object loses its information. (f.e. when we open a new window)
I searched on the web and came across these pages:
http://forums.lhotka.net/forums/thread/19319.aspx
http://forums.lhotka.net/forums/thread/908.aspx
It’s not very clear to me though. Is it possible to make sure we always set/get the User in the same thread?
Does it require changes to the csla, or only to our custom code? And can we store our object in the clientContext?
Does the new CSLA 3.0 support these issues in WPF?
Thanks for your time!
The solution (that I've come up with) requires a bit of code in the UI. You can look at the Using CSLA .NET 3.0 ebook for details, and/or look at the code in MainForm in PTWpf (from 3.0.3) to see the technique.
However, this did require a change to CSLA .NET itself so the data portal raises an event so you can set the thread's principal at the right time. That change is in 3.0.
CSLA 3.0 adds support for WPF. It recognizes that WPF runs multiple threads and stores the Prinicipal in a cache so it is always available to any thread. Check out the eBook for a lot of details.
Joe
Copyright (c) Marimer LLC