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

  • Home
  • SEARCH
  • 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 6218913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:41:26+00:00 2026-05-24T07:41:26+00:00

Take this simple example: class Program { static void Main(string[] args) { var windsorContainer

  • 0

Take this simple example:

class Program
{
    static void Main(string[] args)
    {
        var windsorContainer = new WindsorContainer();
        windsorContainer.Install(new WindsorInstaller());

        var editor = windsorContainer.Resolve<IEditor>();
        editor.DoSomething();

        Console.ReadKey();
    }
}

public class WindsorInstaller : IWindsorInstaller
{
    public void Install(IWindsorContainer container, IConfigurationStore store)
    {
        container.AddFacility<TypedFactoryFacility>();

        container.Register(Component.For<ISomeOtherDependency>().ImplementedBy<SomeOtherDependency>());
        container.Register(Component.For<IReviewingService>().ImplementedBy<ReviewingService>());
        container.Register(Component.For<IEditor>().ImplementedBy<Editor>());
        container.Register(Component.For<Func<IReviewingServiceFactory>>().AsFactory());
    }
}

public interface IEditor
{
    void DoSomething();
}

public class Editor : IEditor
{
    private readonly Func<IReviewingServiceFactory> _reviewingService;

    public Editor(Func<IReviewingServiceFactory> reviewingService)
    {
        _reviewingService = reviewingService;
    }

    public void DoSomething()
    {
        var rs = _reviewingService();
        var reviews = new List<string> {"Review #1", "Review #2"};
        var reviewingService = rs.Create(reviews);

        reviewingService.Review();
    }
}

public interface IReviewingServiceFactory
{
    IReviewingService Create(IList<string> reviews);
}

public interface IReviewingService
{
    void Review();
}

public class ReviewingService : IReviewingService
{
    private readonly IList<string> _reviews;
    private readonly ISomeOtherDependency _someOtherDependency;

    public ReviewingService(IList<string> reviews, ISomeOtherDependency someOtherDependency)
    {
        _reviews = reviews;
        _someOtherDependency = someOtherDependency;
    }

    public void Review()
    {
        Console.WriteLine("Reviewing...");
    }
}

public interface ISomeOtherDependency
{
}

public class SomeOtherDependency : ISomeOtherDependency
{
}

With this example I would expect the console to output “Reviewing…”. However, Windsor throws exceptions:

No component for supporting the service CastleWindsorTypedFactor.IReviewingServiceFactory was found

What is wrong with my Windsor installer?

  • 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-24T07:41:26+00:00Added an answer on May 24, 2026 at 7:41 am

    You registered Func<IReviewingServiceFactory> instead of IReviewingServiceFactory… try replacing

    container.Register(Component.For<Func<IReviewingServiceFactory>>().AsFactory());
    

    with

    container.Register(Component.For<IReviewingServiceFactory>().AsFactory());
    

    and adapt the code accordingly – then it should work.

    Oh, and another thing – you registered your IReviewingService without specifying a lifestyle, which will default to SINGLETON. That is most likely not what you want, because then your reviews argument will only be passed to the instance when is gets created, which only happens the first time the factory is called…! Additional calls to the factory will return the singleton instance.

    Therefore: Change the lifestyle of IReviewingService to transient, AND create an appropriate release method signature on the factory interface (e.g. void Destroy(IReviewingService service)).

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

Sidebar

Related Questions

take this simple code: class A{ public: virtual void foo() = 0; void x(){
Consider this simple example. Class A { B b; A() { this.b = new
Take this very simple form for example: class SearchForm(Form): q = forms.CharField(label='search') This gets
Take this sample class as an example: [AttributeUsage(AttributeTargets.All, AllowMultiple=true)] public class BugFixAttribute : System.Attribute
I have this very simple br2nl function that I use to take a string
Why doesn't object.__init__ take *args, **kwargs as arguments? This breaks some simple code in
This simple example demonstrates the C++ syntax for calling base class constructors - as
Take the following simple example: interface IVehicle { } class Car : IVehicle {
Ok, I'm very simply trying to take this example... http://jsfiddle.net/shanabus/HGF59/ and put it on
Take a simple XML file formatted like this: <Lists> <List> <Note/> ... <Note/> </List>

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.