Modules, page flow and state

Topics: Web Client Software Factory
Nov 22, 2006 at 11:03 AM
In the ElectronicFundsTransfer, when the page flow is abandoned, the state lives on in the session state.

In my opinion, this state should be in the page flow.

From what I understood, so far, only one page flow per session is allowed. If so, I don't think it's a realistic solution because (as a electronic bank client) I'm often running several page flows per session in my tabbed browser (or different browser windows running in the same session).

If I understood it correctly, a module is needed for each page flow. I would look at a module as a business module. Let’s take the electronic funds transfer as an example, I can have transfers between the same client’s account, between accounts of the same bank, between accounts of the same country, between accounts of the same zone (like European Union) and so on. From my point of view this would all be different page flows with different entry points to avoid loading a really big page flow on all navigations.

Having the previous scenario in mind, some pages could be shared between page flows and that would make it impossible to infer the page flow from the URL being navigated to. It would be nice to have a page flow entry point and flow between pages of that page flow instead of getting the page flow for each page.

Did I fail to understand the architecture or am I trying to misuse it?
Nov 22, 2006 at 7:34 PM
I was able to use PageFlowState in the ElectronicFundsTransferController with this minor changes:

private const string KEY_TransfersBatch = "transfersBatch";
protected List<Transfer> Transfers
{
get
{
if (ElectronicFundsTransferPageFlow.UserData.Contains(KEY_TransfersBatch))
{
return (List<Transfer>)(ElectronicFundsTransferPageFlow.UserDataKEY_TransfersBatch);
}
return null;
}
set
{
ElectronicFundsTransferPageFlow.UserDataKEY_TransfersBatch = value;
}
}

public virtual void AddTransferToBatch(Transfer transfer)
{
Guard.ArgumentNotNull(transfer, "transfer");

List<Transfer> transfers = Transfers;

if (transfers == null)
{
transfers = new List<Transfer>();
}

Account acct = Accounts.Find(delegate(Account match) { return match.Number == transfer.SourceAccount; });
if (acct != null)
{
transfer.SourceAccountName = acct.Name;
}
acct = null;
acct = Accounts.Find(delegate(Account match) { return match.Number == transfer.DestinationAccount; });
if (acct != null)
{
transfer.DestinationAccountName = acct.Name;
}

transfers.Add(transfer);
Transfers = transfers;
}
Nov 22, 2006 at 7:50 PM
With the way dependency injection works in the current wcsf, I don't see this scenario being supported out of the box. although it would definitely be beneficial if wcsf uses a factory based strategy to inject the controllers into the presenters, and services into the controllers.

I guess the work around right now would be using a controller factory to tie multiple controller-pageflow pairs into a module. that way you can reuse the views for multiple page flows.
Nov 22, 2006 at 11:31 PM
This was a quick implementation with the less code change possible.

Although WF needs to have it's state pushed in because you can't hold a reference to something inside the workflow instance from the outside, it makes sense to me to be like this for every page flow implementation.
Nov 28, 2006 at 9:51 AM
I forgot to post another change I had to make.

See:

http://www.codeplex.com/Project/DisplayThread.aspx?ProjectName=websf&ForumId=1269&ThreadId=2591