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 7597551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:11:03+00:00 2026-05-30T22:11:03+00:00

I have a data processing application, it has several workflows that extract data and

  • 0

I have a data processing application, it has several workflows that extract data and generate a report.
The workflows take a list of data extractors and a reporting service.
The workflow to run is determined at runtime.

I have configured the workflow creation using structure map, given a workflow key it will generate an instance of a workflow. I am new to structure map and here the first configuration I have got to work.

Does this look correct or have I missed something? Is there a better way to configure this?

Here is the registry class:

class WorkflowRegistry : Registry
{
    public WorkflowRegistry()
    {
        var container = new Container(x =>
        {
            x.For<DossierExtraction.Library.Interfaces.IProgressReporter>().Use<ProgressReporter>();
            x.For<IDossierService>().Use<DossierService>();
            x.For<IReportingService>().Use<VendorReportingService>().Named("VendorReport");
            x.For<IReportingService>().Use<ClientReportingService>().Named("ClientReport");
        });

        For<IWorkflow>().Add(x => new GenericWorkflow(
            new List<IExtractionService>() { container.GetInstance<DossierExtractor>(), container.GetInstance<NativeExtractor>(), container.GetInstance<TranslationExtractor>() },
            container.GetInstance<IReportingService>("VendorReport")
            )).Named("VendorWorkflow");

        For<IWorkflow>().Add(x => new GenericWorkflow(
            new List<IExtractionService>() { container.GetInstance<TranslationExtractor>() },
            container.GetInstance<IReportingService>("ClientReport")
            )).Named("Clientflow");
    }
}

Here is a snippet showing the usage of the registry class in my application.

ObjectFactory.Initialize(x =>
        {
            x.AddRegistry<WorkflowRegistry>();
        });

        var workflow = ObjectFactory.GetNamedInstance<IWorkflow>(workflowKey);
        workflow.Run();
  • 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-30T22:11:04+00:00Added an answer on May 30, 2026 at 10:11 pm

    I would say that you have a couple of things that can be changed.

    The new container in the registry is not needed, inside the Add methods for the Workflows, you can get the instance using your lambda (x.GetInstance<Type>("name").

    The Use method is registering a default for a specific instance. If you don’t need a default, use Add instead (IReportingService).

    I generally try to avoid calling specific constructors inside the configuration, since it makes it harder to add new parameters to a contructor. Prefer the Ctor method instead. In this case with the Lists being passed and if this is the entire application it might be overkill with the Ctor/Is combo.

    Here is my suggestion:

    public WorkflowRegistry()
    {
        For<IProgressReporter>().Use<ProgressReporter>();
        For<IDossierService>().Use<DossierService>();
        For<IReportingService>().Add<VendorReportingService>().Named("VendorReport");
        For<IReportingService>().Add<ClientReportingService>().Named("ClientReport");
    
        For<IWorkflow>().Add<GenericWorkflow>().Named("VendorWorkflow")
            .Ctor<IReportingService>()
            .Is(c => c.GetInstance<IReportingService>("VendorReport"))
            .EnumerableOf<IExtractionService>().Contains(
                x => { 
                    x.Type<DossierExtractor>();
                    x.Type<NativeExtractor>();
                    x.Type<TranslationExtractor>();
                });
    
        For<IWorkflow>().Add<GenericWorkflow>().Named("Clientflow")
            .Ctor<IReportingService>()
            .Is(c => c.GetInstance<IReportingService>("ClientReport"))
            .EnumerableOf<IExtractionService>()
            .Contains(x => x.Type<TranslationExtractor>());
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that has many threads processing data. As part of this
Background Information I have a distributed processing application that does data analysis. It is
I'm processing data from an application that has a few quirks in how it
I have a pseudo-realtime data processing application where I would like to use LazyInit<double>
I have a SQL Server that holds a lot of data. An application, running
I have a Python application. It has an SQLite database, full of data about
Our application has a very large, wide table of transactional data. We have a
Scenario I have an web application which needs some calculations and processing on data.
I have a data-mining application that accesses a web-site to retrieve records on an
I have been working on a C# WinForms application that registers several hot keys

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.