persisting data in page flow, documentation for RI

Topics: Web Client Software Factory
May 9, 2007 at 5:54 AM
How do I persist data across pages in a page flow? Pointer to any documentation? Where can I find detail documentation for reference implementaion (GlobalBank). Thanks.
Coordinator
May 9, 2007 at 2:19 PM
Hi,
The PageFlow instance has a property named UserData, that serves as a bag for persisting state for the lifetime of that pageflow instances.
You can see a sample of the code in the EFTController class of the reference implementation. The Transfers property stores the list of transfers in the pageflow state:
        public virtual List<Transfer> Transfers
        {
            get
            {
                if (EFTPageFlow.UserData.Contains("Transfers"))
                {
                    return EFTPageFlow.UserData["Transfers"] as List<Transfer>;
                }
                return null; 
            }
            private set
            {
                EFTPageFlow.UserData["Transfers"] = value;
            }
        }

One thing to have in mind, is that the object to store must be serializable.
For more information on managing state with pageflow, you can take a look at the documentation that comes with WCSF: Inspecting the Software Factory Assets -> Application Blocks -> PageFlow Application Block -> Development Activities -> Using State with PageFlow

Let me know if this helps,
Julián Domínguez
http://staff.southworks.net/blogs/jdominguez
May 11, 2007 at 5:40 AM
Thanks Julian,

May 17, 2007 at 8:43 PM
Edited May 18, 2007 at 2:02 AM
If you are within a pageflow activity then you need to use the UserDataStore property not UserData as UserData does not serialize. If however you are external i.e. in a presenter, then use UserData as is showing in Julian's code.

Glenn