Workflow TV

Workflow TV - How To Build Workflow Services with a Database Repository

Download this episode

Download Video

Description

Customers often ask me

How can I store my Workflow Service definitions (xamlx files) in a database with IIS and AppFabric?

On this episode I'll show you how you can create a VirtualPathProvider that enables you to build a Workflow respository with a database.

Links

Ron Jacobs
http://blogs.msdn.com/rjacobs
Twitter: @ronljacobs http://twitter.com/ronljacobs

Tags:

WF, WF4

Embed

Format

Available formats for this video:

Actual format may change based on video formats available and browser capability.

    The Discussion

    • Enrique GC

      Ron, first of all great post, secondly, maybe not the most accurate tittle, more than loading workflows definitions form the DB (.xaml file content) or any other way that it can  be turned into some string value using the DynamicActivity method i.e:

      var activity = ActivityXamlServices.Load(new StringReade(wokflowToExecute)) as DynamicActivity;

      This is an elegant workaround to implement service partitioning on WF, back in the
      beta I asked something like that http://social.msdn.microsoft.com/Forums/en/wfprerelease/thread/41ecf7c5-8c74-4ec9-9bdf-437015b17ceb

      The "limitation" of one WorkflowServiceHost per WF service is one of the reasons I decided to no
      use WF services on one of our company's main solutions, given the number of services to implement, using WCF routing wouldn't be as practical or maybe not a clean, and using pick activities would be irrational, so we used plain WCF instead.

      Currently we have another interesting scenario and the approach you're following gives me another option on how to handle this situation, so, thanks Ron and keep up the good stuff coming.

    • rojacobs

      I don't understand your comment about WorkflowServiceHost being limited.  It is no different than a WCF ServiceHost.  The WCF Service Host will host one service per host.  The WF WorkflowServiceHost will host one workflow per host.

      However, you can have multiple services and workflow services in you web application.  In fact you don't really deal with the WorkflowServiceHost or ServiceHost classes unless you are self-hosting so they are just another part of the infrastructure most of the time.

      • WCF services have a collection of operations
      • WF services also have a collection of operations

      The main difference is that the WF service can enforce a messaging protocol with certain operations being available only at certain times.

      My guess is that if you can build your solution with WCF services you can also build it with workflow services.

    • Gustavo_

      Hi Ron, I thought about this idea some time ago, the problem that I found is the config file, this kind of file can´t be provided by a VirtualPathProvider, so is needed to use pre-defined configs, losing flexibility with this.
      What do you think about? Do you have some idea or workaround?

      Regards

    • rojacobs

      Can provide a web.config with the VirtualPathProvider?  I didn't know that.

      I wonder if you could support a VirtualDirectory and then place a web.config file in the VirtualDirectory with the config you need if that would work.

      It would be worth a try.

    • Ramesh

      Hi Ron, Good post.
      I have almost same kind of requirement in our project, but we are using Oracle 11g. Will Oracle 11g support to store workflow service? If so what are all changes needs to be done?

      Regards
      Ramesh

    • rojacobs

      You can store the workflow definitions in Oracle - I'm using Entity Framework 4.1 in my code so you would need a provider that works with Entity Framework.

      However, at this time we do not have a Workflow persistence provider for Oracle.  You won't need this unless your workflows are long running.

    • Ramesh

      Thanks for your quick reply.

      Can I implement BPM using State Machine WF?

      Here is the scenario I would like to implement...
      Step 1: Create Purchase Request (PR). State of PR at this stage is "Created".

      Step 2: On Step1, WF should assign a task to "Purchase Manager".

      Step 3: When Purchase Manager logs into to system, in his dashboard this task should be visible. At this stage he will have two actions "Approve" and "Reject".

      Step 4: On click of "Approve", again task should assign to Finance Manager. On click of "Reject" the PR state changes to "Rejected"

      Step 5: When Finance Manager logs in task should be visible in his dashbaord with "Approve" and "Reject" actions.

      Step 6: On click of "Approve" Purchase Request state should change from "Created" to "Approved". On click of "Reject" the PR state changes to "Rejected"

      What do you think about? Will this can be implemented in WF 4.0?

      Regards
      Ramesh

    • Ramesh

      Any update on the above?

      Regards
      Ramesh

    Comments closed

    Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.