Applying TrackingProfiles to a base class workflow and all sub-classes

Is there any way of applying the same TrackingProfile to all workflow instances that inherit from a common base class workflow e.g.

BaseWorkflow ---> has its own tracking profile

DerivedWorkflow1 : BaseWorkflow
DerivedWorkflow2 : BaseWorkflow
etc.

My experiments suggest that when using the SQL Tracking service a separate (in my case identical) profile must be defined for each and every DerivedWorkflow type: a BaseWorkflow profile is not applicable to the derived workflows.

This is a bit of a maintenance headache when large numbers of derived workflows exist.




Answer this question

Applying TrackingProfiles to a base class workflow and all sub-classes

  • KevinKerr

    Thanks for the suggestions. It is unlikely that other workflow types will be tracking in the same DB so I'll update the default profile.
  • DanBog

    You could do this in a custom tracking service (which is handed the type and asked for the profile), but the SQL tracking service looks in the database for an entry that matches the actual type of the workflow and does not consider base types.

    Matt



  • axl

    You can specify a profile for a specific type and still keep the original default profile if you want. Basically the logic goes... Look for a profile for the specific type of workflow that is starting. If found use it. If not is the UseDefaultProfile flag enabled (true by default) If yes associated the default profile to the workflow type and use it. If not return no profile and no tracking will occur.

    To insert or update a profile for a specific workflow type in the SqlTrackingService database use the UpdateTrackingProfile stored proc. To update the default profile use the UpdateDefaultTrackingProfile stored proc.

    Thanks,
    Joel West
    MSFTE - SDE in WF runtime and hosting

    This posting is provided "AS IS" with no warranties, and confers no rights


  • Perry Choy

    Sorry Joel, maybe my original question wasn't clear. I have been using the tracking service in exactly the way you describe: however this is not sufficient as I have over 50 workflow classes (with the facility for the user to dynamically generate more at runtime) and I do not want to specify a separate tracking profile for each. As all workflows inherit from a common base class I want to have a single tracking profile for all of these. I hoped that I could apply some kind of "MatchDerivedTypes" at the base workflow type level so that the SqlTrackingService would use this profile for all of my workflows. However the GetProfile sprocs don't work this way, every profile must be matched to a specific type.

    Jon's idea of replacing the default profile seems to be the best approach here. I think inheritable tracking profiles would be a nice feature for a future version of WF however.

  • Eric Robert

    OK, understood. Thanks to everyone for the suggestions.

  • simonii

    If these are the only workflow types you are tracking - you can replace the default tracking profile in the database. It is in its own table. That way this profile would be applied as the default.

  • kageg

    I think Joel was clarifying that you can insert your shared profile as the default profile, which gives you what you want (all of your derived types will use that default profle).

    But, in the case where you want to use a different profile, either for one of these derived types or some other type, if you insert the type specific profile, it will get used.

    Basically, use the default profile for your shared, but you are not stuck if you need to use a different profile for a specific type later on.

    Matt



  • Applying TrackingProfiles to a base class workflow and all sub-classes