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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:29:52+00:00 2026-05-20T17:29:52+00:00

I use S#arp Architecture which uses Windsor Castle for IoC. I got a new

  • 0

I use S#arp Architecture which uses Windsor Castle for IoC. I got a new controller now that, unlike all other controllers in the project, need a different implementation of the same interfaces. I.e. all controllers use ProductsRepository: IProductsRepository as implementation, but the new one has to use SpecificProductsRepository.

How do I configure it to recognize and manage this automatically? Either in pure Windsor way, or with ASP.NET MVC help (e.g. in my custom controllers factory).

OK looks like I need subcontainers. Still searching.

  • 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-20T17:29:52+00:00Added an answer on May 20, 2026 at 5:29 pm

    An easier and much simpler way would be to use Windsor’s service overrides.

    E.g. register your repos like so:

    container.Register(Component.For<IProductsRepository>
                         .ImplementedBy<ProductsRepository>()
                         .Named("defaultProductsRepository"),
                       Component.For<IProductsRepository>
                         .ImplementedBy<SpecificProductsRepository>()
                         .Named("specificProductsRepository"));
    

    which will ensure that the default implementation is ProductsRepository. Now, for your specific controller, add a service override like so:

    container.Register(Component.For<NewController>()
         .ServiceOverrides(ServiceOverride
              .ForKey("productsRepository")
              .Eq("specificProductsRepository"));
    

    You can read the docs here.

    Edit: If you want to register your repositories with AllTypes, you can adjust the registration key e.g. like so:

    container.Register(AllTypes.[how you used to].Configure(c => c.Named(GetKey(c)));
    

    where GetKey e.g. could be something like:

    public string GetKey(ComponentRegistration registration)
    {
        return registration.Implementation.Name;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just started to use the newest version of S#arp Architecture 1.9.5, which
Using S#arp Architecture 2.3 RC , I am trying to publish two websites which
Does DHCP use ARP only as communication protocol to assign an IP Address?
use Text::Table; my $tb = Text::Table->new(Planet,Radius\nkm,Density\ng/cm^3); $tb->load( [ Mercury,2360,3.7], [ Mercury,2360,3.7], [ Mercury,2360,3.7], );
If I use arp and arping on machines in my local network I get
I want to look up a MAC adrress by an IP. use Net::ARP; $mac
I am using the s#arp framework and want to use the latest mvc contrib.
I decided to use ASP.NET MVC, S#arp Architectur and the Spark View Engine for
I'm using S#arp architecture to develop my web site. I've decided on using memcached
I have struct that store info about ARP packet and I need to save

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.