Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 333787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:59:38+00:00 2026-05-12T09:59:38+00:00

This seems like an elementary question, but I can’t find the answer anywhere: I

  • 0

This seems like an elementary question, but I can’t find the answer anywhere:

I have several different types of long-running state machine workflows that I am working with across multiple host applications with a central database. I am using the SqlWorkflowPersistenceService to persist them. So say I have three workflow types WorkflowOne, WorkflowTwo, and WorkflowThree. An instance of each of those is started and persisted to the database by one user. Another user comes along and wants to make various changes, so they fire up the application. Now I can use the persistence service to give me a list of all the persisted instances but how do I know which is of type WorkflowOne and which is WorkflowTwo or WorkflowThree?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T09:59:38+00:00Added an answer on May 12, 2026 at 9:59 am

    There are a few ways you can do this.

    First option is to use the WorkflowPersistenceService itself and do something like:

    var persistenceService = new SqlWorkflowPersistenceService("<<connection string>>");
    var persistedWorkflows = persistenceService.GetAllWorkflows();
    foreach (var persistedWorkflow in persistedWorkflows)
    {
        var workflowInstance = workflowRuntime.GetWorkflow(persistedWorkflow.WorkflowInstanceId);
        var workflowDefinition = workflowInstance.GetWorkflowDefinition();
        Console.WriteLine(workflowDefinition.GetType().FullName);
    }
    

    Easy to do as you are already using the SqlWorkflowPersistenceService but it has the drawback of having to load all workflow instances into memory and you are responsible for removing them from memory.

    The second option is to use workflow tracing:

        var trackingQuery = new SqlTrackingQuery("<<connection string>>");
        var queryOptions = new SqlTrackingQueryOptions()
        {
            WorkflowStatus = WorkflowStatus.Running
        };
        var runningWorkflows = trackingQuery.GetWorkflows(queryOptions);
        foreach (var runningWorkflow in runningWorkflows)
        {
            Console.WriteLine(runningWorkflow.WorkflowType);
        }
    

    The advantage is you don’t need to load the actual workflow definition into memory just to check it’s type. The drawback is you have to add the SqlTrackingService as well with it’s own database adding complexity and overhead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This seems like a simple question, but I can't find it documented anywhere. I'd
This seems like the simplest Git question, but I can't find ANYTHING on it.
This seems like a simple problem but I can't seem to find the answer.
This seems like a repeated question but i'm not able to get my answer.
This seems like it should be easy, but I can't quite find an explanation
This seems like an elementary question, but after a lot of searching around I
This seems like a common CSS question, but for some reason I cannot find
This seems like a fundamental question, but I haven't found a clear answer. I'm
This seems like an elementary issue but it has me stumped. I have a
This seems like a pretty softball question, but I always have a hard time

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.