- The Web Client Software Factory allows (among many other things) to create structured Web Applications following the Model-View-Presenter pattern where the page flow (communication between aspx pages) is handled by Workflow Foundation (if we choose this provider as the pageflow provider). Any other Page flow provider can be plugged in, however. It is interesting to see Workflow Foundation playing an important role both in the Business Layer and in the presentation layer; here we’ll focus on the presentation layer.
- The following text and pictures illustrate the PageFlowWithShoppingCartQuickstart example and in particular how Workflow Foundation can help.
- Here is the login page :
Click on add to cart" and so on… The flow between the pages is organized by a State Machine (Windows Workflow Foundation) workflow:
If we take a look at the property page of the "Browse catalog" state activity, we’ll notice that the activity is linked with the aspx page (no "Presenter" in this sample).
The BrowseCatalog activity is an instance of a PageFlow activity which is a State Activity provided the Pattern & Practise group as illustrated in the next picture :
Each state activity is linked with an aspx page ("the View"). The following code illustrates what’s going on in the aspx page ("the View") when we add something ino the cart: (the view asks the controller("the Model") to add something in the car)
And here is the code in the controller:
The "addItem" string (previous picture) makes the mapping with the addItem event driven activity which illustrated in the next picture:
Normally the Web Client Software Factory encourages the developer to follow the Model-View-Presenter pattern which is not the case in this very simple example (there is no distinct presenter which makes the UI Unit testing almost impossible).
This is just a quick look; in the coming weeks, I’ll provide more details on the role of Workflow Foundation in the Web Client Software Factory.