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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:05:39+00:00 2026-05-29T05:05:39+00:00

I have an abstract base class Search . An abstract class IndexedRepositorySearch descends from

  • 0

I have an abstract base class Search. An abstract class IndexedRepositorySearch descends from Search. An abstract class FacetSearch descends from IndexedRepositorySearch. Concrete classes IngredientFacetSearch and RecipeFacetSearch descend from FacetSearch.

Currently we’re registering everything that descends from Search with Castle Windsor as follows:

AllTypes.FromAssembly(assembly)
        .BasedOn<Search.Search>()
        .WithServiceBase()
        .WithServiceSelf()
        .LifestyleTransient()
        .AllowMultipleMatches()

When we then call

_container.ResolveAll<FacetSearch>(new { searchInput = input, searchResults });

It does not resolve anything from the container. When I put a breakpoint on the container after everything has been registered and check AllComponents in the debugger, I see both IngredientFacetSearch and RecipeFacetSearch, but they each only have two Services associated with them: their self and Search, their base. Which you would expect given that they registered with .WithServiceBase() and .WithServiceSelf().

So the question is how to get them to resolve by calling ResolveAll<FacetSearch>()?

I’m sure it’s something simple but I’ll be darned if I can find it.

Thanks in advance.

  • 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-29T05:05:43+00:00Added an answer on May 29, 2026 at 5:05 am

    We had a simliar problem to this, but only needed to register the first base which was abstract. I solved it using WithServiceSelect but wrapped it up into an extension method to be used so:

    AllTypes.FromAssembly(assembly)
            .BasedOn<Search.Search>()
            .WithServiceLastAbstractBase(),
    

    The definition of the extension method is:

    public static BasedOnDescriptor WithServiceLastAbstractBase(this BasedOnDescriptor basedOn)
    {
        return basedOn.WithServiceSelect(selectLastAbstractBase);
    }
    
    private static IEnumerable<Type> selectLastAbstractBase(Type type, Type[] basetypes)
    {
        var baseType = type;
    
        do
        {
            baseType = baseType.BaseType;
        } while (baseType != null && !baseType.IsAbstract);
    
        if (baseType == null)
        {
            throw new ArgumentException("There are no abstract base types for: " + type);
        }
    
        return new [] { baseType };
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an abstract base class from which many classes are derived. I want
I have an abstract base class called Shape from which both Circle and Rectangle
I have an abstract base class that holds a Dictionary. I'd like inherited classes
I have a abstract base class A and a set of 10 derived classes.
I have a abstract base class that I have many inherited classes coming off
I have an abstract base class and two derived classes. The base class contains
I have an abstract base class that many classes extend. I'd like all these
I have an abstract base class called Curve . There are three classes that
I have an abstract base class that enforces certain operations on all derived classes.
I have an abstract base class (Comparable) with Date and Time virtually inheriting from

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.