OT: Driving the UI with WF

OT: Driving the UI with WF

Old forum URL: forums.lhotka.net/forums/t/7798.aspx


SonOfPirate posted on Thursday, October 15, 2009

I've been trying to resolve a design problem for a while now and find myself getting nowhere with other forums, blogs posts, articles, etc. so I am turning to my trusted source for guidance...

I am designing an application that uses Workflow Foundation to define the processing logic for a series of transactions.  One goal is to support multiple UIs that share the processing logic.  One of these clients will be a Silverlight application so I have to place a WCF service interface between my client application and the host application where the workflow is running.

Using a simple Order Entry process as an example, the user selects Order Entry in the client which triggers a call to the StartOrderEntry service method on the host.  This starts the OrderEntryWorkflow.

The first condition the workflow evaluates is whether the current user is a dedicated account manager, meaning they only support a single account, or not.  If they are dedicated, there is no need to prompt for the account and the workflow moves on to the "Ship To" prompt (below).  Otherwise, the workflow needs to tell the client to display the "Select Account" prompt and respond with the user's selection.

The next prompt is to select the "Ship To" location for the order from all of the account's locations.  Again, if there is only one, we don't need to prompt and the workflow moves on the next step.  However, some customers may want to see a confirmation displayed just for assurance.  This is one of the reasons we are using WF to drive the process - because we can customize it to fit the individual customer's needs.

As you can see just from this small portion, the first call could result in any one of three or more pages/forms being displayed depending on the current user, system settings, workflow logic, etc.  And, this logic repeats itself through the entire order entry process until we finally submit the order and the workflow exits, instructing the client to return to the main screen.

My problem is working out how the communication between the client and the host should work.  My default, WF wants to run asynchronously from the client app, which may or may not be problematic when dealing with Silverlight or ASP.NET clients.  If I use a return value on my service method calls to convey instructions, my workflow gets very complicated as the ReceiveActivity has to span all of the business logic necessary to come up with the return object.  Callback contracts or duplex channels seem complicated as well.

So, I am looking for any practical advice anyone might have.  I can't imagine that I am charting new territory!  Thx!!!

 

Copyright (c) Marimer LLC