Now that we've completed our WinForms implementation, I'm trying to build an ASP.NET application using the same business and data layers. So far it's working very well, but there are a few curve balls here and there.
I'm finding when I set values in ApplicationContext.GlobalContext during the processing of a request, that the values are gone when the next request comes in. This is very different than what happens in a WinForms application, where the values persist for the life of the application, so I wasn't expecting this. However, in looking at the implementation, it seems like this is what was intended.
A possible and obvious alternative that would work for my intended purposes is so use the Session instead, but is there a better alternative? In this particular case, I was trying to set something at runtime that would persist for any subsequent requests (even from different Sessions), but I can make it work using the Session.
This is just a difference between smart client and web development. The CSLA ApplicationContext is lost between page requests. Anything you want to have stick around needs to be in Session or a database.
OK, thanks. I can live with that. It means that I have to make some changes where I stored and retrieved data from the GlobalContext, but your "provider" model works well for this. The smart client can use a default value provider that uses the GlobalContext as is, and the web application can substitute a an alternative that reads/writes from the session or database in cases where we need the data to persists between page requests.
Copyright (c) Marimer LLC