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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:39:28+00:00 2026-05-24T22:39:28+00:00

I have been building a new .NET solu­tion with Cas­tle per­form­ing my DI. Its

  • 0

I have been building a new .NET solu­tion with Cas­tle per­form­ing my DI.

Its now at the stage where i would like to con­trol the order in which my installers run. I have built indi­vid­ual classes which implement IWind­sorIn­staller to han­dle my core types — eg IRepos­i­tory, IMap­per and ISer­vice to name a few.

I see that its suggested i implement my own Installer­Fac­tory (guessing i just override Select) in this class.

Then use this new factory in my call to:

FromAssembly.InDirectory(new AssemblyFilter("bin loca­tion")); 

My ques­tion — when over­rid­ing the save method — what is the best way to force the order of my installers.

  • 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-24T22:39:29+00:00Added an answer on May 24, 2026 at 10:39 pm

    I know its already solved but I couldn’t find any example on how to actually implement the InstallerFactory so here’s a solution if anyone is googling for it.

    How to use:

    [InstallerPriority(0)]
        public class ImportantInstallerToRunFirst : IWindsorInstaller
        {
            public void Install(IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
            {
                // do registrations
            }
        }
    

    Just add the InstallerPriority attribute with a priority to your “install-order-sensitive” classes. Installers will be sorted by ascending. Installers without priority will default to 100.

    How to implement:

    public class WindsorBootstrap : InstallerFactory
        {
    
            public override IEnumerable<Type> Select(IEnumerable<Type> installerTypes)
            {
                var retval =  installerTypes.OrderBy(x => this.GetPriority(x));
                return retval;
            }
    
            private int GetPriority(Type type)
            {
                var attribute = type.GetCustomAttributes(typeof(InstallerPriorityAttribute), false).FirstOrDefault() as InstallerPriorityAttribute;
                return attribute != null ? attribute.Priority : InstallerPriorityAttribute.DefaultPriority;
            }
    
        }
    
    
    [AttributeUsage(AttributeTargets.Class)]
        public sealed class InstallerPriorityAttribute : Attribute
        {
            public const int DefaultPriority = 100;
    
            public int Priority { get; private set; }
            public InstallerPriorityAttribute(int priority)
            {
                this.Priority = priority;
            }
        }
    

    When starting application, global.asax etc:

    container.Install(FromAssembly.This(new WindsorBootstrap()));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to building iphone apps. Have been searching the net on how
I have been building IMO a really cool RIA. But its now close to
I have been building a new application using my current understanding of domain driven
I have been slowing learning and building my first android app. I'm VERY new
I am new to WP7 programming and I have been following this tutorial http://weblogs.asp.net/scottgu/archive/2010/03/18/building-a-windows-phone-7-twitter-application-using-silverlight.aspx
I have been tasked with building a new system that models a virtual filesystem.
I am absolutely new to the Android platform and have been building an application
I have been building a game for a while (nearly done) - But the
I have been investigating building web parts for sharepoint 2010 and currently have a
I have been involved in building a custum QGIS application in which live data

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.