locked
Custom Sql Persistence RRS feed

  • Question

  • Hi,

    I need to store the state of the workflowInstance in sql db. Apart from that, I need to store UserId, taskID, etc., in the database.

    As per the sql schema that comes with WF [sql scripts] does not support. So, I need use my own custom sql persistence.

    Kindly let me know, if someone has solution for this, please share with me.

    Thanks in advance,

    chandru.

    Wednesday, May 31, 2006 5:27 AM

Answers

  • Chandru - you want to look at tracking for storing data other than the persisted workflow.

     

    Workflow Persistence is really for robustness (saving the last known good state to start the workflow again in case of a exception) and load balanacing (allowing another machine than the one that started the workflow or ran it last to run it now).

     

    Workflow Tracking is all about keeping a running log of the activities that have executed - as well as (potentially) data that needs to be kept about each workflow (running or not).

     

    Wednesday, May 31, 2006 5:50 AM

All replies

  • Chandru - you want to look at tracking for storing data other than the persisted workflow.

     

    Workflow Persistence is really for robustness (saving the last known good state to start the workflow again in case of a exception) and load balanacing (allowing another machine than the one that started the workflow or ran it last to run it now).

     

    Workflow Tracking is all about keeping a running log of the activities that have executed - as well as (potentially) data that needs to be kept about each workflow (running or not).

     

    Wednesday, May 31, 2006 5:50 AM
  • Thanks for your quick response Jon.

    Do you have any samples regarding workflow tracking services, please let me know.

    Thanks

    chandru

    Wednesday, May 31, 2006 5:57 AM
  • There are certainly samples in the SDK.  What I think people should to do to get a good idea of tracking is the following.

    1) Create the databases - the scripts for doing so are in C:\WINDOWS\WinFX\v3.0\Windows Workflow Foundation\SQL\{language}

    Create a new database - then run the Tracking_schema.sql script followed by the Tracking_logic.sql script (instructions are also in the help flle).

    2) In your host before you start the workflow runtime (or create your first workflow) - add the sql tracking service

    SqlTrackingService ts = new SqlTrackingService("server=.;database=wftracking;trusted_connection=yes");

    workflowRuntime.AddServer(ts);

    3) Fire up the workflow monitor example that comes with the SDK samples (under samples\applications).  Add a reference to the dll (or exe) that contains your workflow.

     

    4) Run your workflow a few times.

    5) Run Workflow Monitor - you should be able to see what steps your workflow has gone through.

     

    Look under samples\applications\trackingprofileeditor for an example of how to modify the tracking profiles.  By default the SqlTrackingProfile service tracks all Workflow events and Activity events - you need to change the profile to track data extracts.

    Wednesday, May 31, 2006 6:05 AM
  • Hi Jon,

    Thanks for your response. But, I am very much confused.

    Let me explain my requirements.

    1) I need to develop an asp.net app to manage documents, ie., to approve, reject, etc.,

    2) For that I need to use WF. For tracking of which user has approved, rejected, etc., I need to maintain in sql db. I am using state machine workflow for this.

    3) As per the user, I need to fetch the data from the db to display what documents has been approved by that user, what are the pending tasks to be done, etc.,

    Please let me know, whether WF will be suitable for these kind of requirements.

    Chandru 

    Wednesday, May 31, 2006 6:32 AM
  • Yes - WF is definately useful for those requirements.

     

    What i am suggesting is that you look into the WF Tracking infrastructure rather than the persistence infrastructure for information about storing application specific data

    Wednesday, May 31, 2006 6:36 AM
  •  

    Jon, could you please share more information about tracking steps you described?

    I've found SQL scripts you wrote about (though they were in different directory ;-)) but i'm not sure what to do with them in order to make your ASP.NET Workflow Monitor Implementation work (It always gives me an "stored procedure not found" error). I mean in ms sql server 2000 you just put these scripts in querry analizer and run them (but you have to define on which db they shoud be executed which means you have to create this db first). So i have no idea how to run these scripts (and in what order too) on SQL express. And what db should i create and how should i call it.

    Hope to read from you soon.

    P.S. you could at least put some small readme in your ASP.NET Workflow Monitor Implementation :-) 

    Monday, July 24, 2006 11:31 AM
  • Chandru,

     

    maybe is it a stupid question, but do you know that Windows Sharepoint Services 3 provides these functionnalities as out of the box features;

    The workflows in sharepoint 3  (based on WF) extends the WF model with the notion of "tasks" ;

    Take a look at the following webcast (18/7) . Amazing!!! I've tested it this w-end...

     

    Serge


    Serge Luca; Guidance Belgium; blog:www.redwood.be

     

     

     

    Monday, July 24, 2006 11:46 AM
  • Ok. i did everything as it says in tracking monitor instructions

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/WF_Samples/html/4f70c1c5-f82d-4d5f-8b7d-943b9f99f8e2.asp

    (btw, Jon, you used a 'WfAtlasTracking' db name, but in SDK they use 'Tracking' db name. that was the hardest part, and these breakpoints, are they really neccessary? my VS throws me excpetions and shuts down when there are breakpoints in workflow :)

    But now when i run ASP.NET workflow monitor implementation i get an emprty workflow image on a page :( I dont see any activities on it. Any ideas?

    Wednesday, July 26, 2006 8:08 AM
  • The database name is really up to you - that's why they provide the scripts.  Otherwise they'd just install a database.

    You have to run the exe project a few times to get some tracking data into the database.

    Wednesday, July 26, 2006 3:15 PM
  • Well, exe crashes. I think i should try again few times.

    Thank you for your answer.

    Thursday, July 27, 2006 7:34 AM