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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:11:33+00:00 2026-05-21T20:11:33+00:00

I want to resolve in Windsor a series of classes that implement this interface:

  • 0

I want to resolve in Windsor a series of classes that implement this interface:

public interface IDocumentParser
{
    Message ParseDocument(XDocument document);
    IDocumentParser NextParser { get; set; }
}

Basically what I have is a chain of responsibility, in which the first parser delegates to the next in the chain if it can’t handle the document. I was wondering if there is a way in Windsor to solve this dependency. I tried the following, but it sets my NextParser property to null.

  container.Register(
    Component.For<IDocumentParser>().ImplementedBy<DocumentParser1>(),
    Component.For<IDocumentParser>().ImplementedBy<DocumentParser2>(),
    Component.For<IDocumentParser>().ImplementedBy<DocumentParser3>(),
    Component.For<IDocumentParser>().ImplementedBy<DocumentParser4>());

Any suggestion?

EDIT:

Ok, it looks like the problem was the following: I had a dependent component registered as startable (via the StartableFacility), which got called before my parsers registration.

class DependentObject
{
    public DependentObject(IDocumentParser firstParser) {}
    public void Start() {}
    public void Stop() {}
}

Now, it looks like a startable component gets started as soon as it is registered, thereby stopping in some way the resolution process for all the dependent parsers. For my case I solved by configuring the StartableFacility with a DeferredStart(), like this:

var container = new WindsorContainer();
  container
    .AddFacility<StartableFacility>(
       // Without this container.Resolve<IDocumentParser>().NextParser is null
       c => c.DeferredStart()); 
    .Register(
      Component.For<DependentObject>()
      .StartUsingMethod(m => m.Start)
      .StopUsingMethod(m => m.Stop),
      Component.For<IDocumentParser>().ImplementedBy<DocumentParser1>(),
      Component.For<IDocumentParser>().ImplementedBy<DocumentParser2>(),
      Component.For<IDocumentParser>().ImplementedBy<DocumentParser3>(),
      Component.For<IDocumentParser>().ImplementedBy<DocumentParser4>()
    );

I am wondering, though, why this is happening. In such cases I expect Windsor either to throw an exception, stating that he is unable to solve the IDocumentParser dependency, or solving the whole chain, and not just the first node. Anybody knows if this is by design?

  • 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-21T20:11:34+00:00Added an answer on May 21, 2026 at 8:11 pm

    This is by design – Windsor by default treats property dependencies as optional so when one is requested it does its best to satisfy it, but if it can’t it just doesn’t.

    If you want to force those dependencies to be satisfied either make them mandatory or use service overrides to specify them explicitly

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

Sidebar

Related Questions

I want to use a temp directory that will be unique to this build.
I want to assign the decimal variable "trans" to the double variable "this.Opacity". decimal
I want to make an etag that matches what Apache produces. How does apache
Consider this example: public class Factory { private List<ISubFactory> subFactories; public Factory(List<ISubFactory> subFactories) {
Using Castle Windsor, I want to configure a generic service with a type parameter;
Most of the examples I see for Castle Windsor auto-register type that derive from
I have a method that I want to be transactional in the abstract sense.
I have a problem that I can't seem to resolve. I'm sure it's simple,
I want to find the file name with fullpath from this string [exec] /snschome/sns/ccyp/mb_ccsns/bb/cbil5/v85_8/amdocs/iamcust/bil/cl/business/handlers/ClReportsHandler.java:233:
I want to create a query like this : SQL = SQL + Libelle

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.