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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:20:21+00:00 2026-05-27T22:20:21+00:00

I am trying to configure an application such that types from assemblyA can be

  • 0

I am trying to configure an application such that types from assemblyA can be used by my console to allow for logging in an AOP style. The JournalInterceptor will just write out method calls, input and maybe output arguments to a log file or datastore of some kind.

I can register one type at a time but I would like to register all types in one go. Once I get going I may add some filtering to the registered types but I am missing something.

I am trying to use Classes.FromAssemblyContaining but am not sure how to get at an IRegistration instance for the call to WindsorContainer::Register

Any clues?

// otherAssembly.cs
namespace assemblyA
{
  public class Foo1 { public virtual void What(){} }
  public class Foo2 { public virtual void Where(){} }
}
// program.cs
namespace console
{
  using assemblyA;

  public class JournalInterceptor : IInterceptor {}

  public class Program
  {
     public static void Main()
     {
        var container = new Castle.Windsor.WindsorContainer()
            .Register(
                Component.For<JournalInterceptor>().LifeStyle.Transient,
                // works but can't be the best way
                Component.For<Foo1>().LifeStyle.Transient
                    .Interceptors<JournalInterceptor>(),
                Component.For<Foo2>().LifeStyle.Transient,
                    .Interceptors<JournalInterceptor>(),
                // how do I do it this way
                Classes.FromAssemblyContaining<Foo1>()
                        .Pick()
                        .LifestyleTransient()
                        .Interceptors<JournalInterceptor>()
                      );

        Foo1 foo = container.Resolve<Foo1>();
     }
  }
}
  • 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-27T22:20:21+00:00Added an answer on May 27, 2026 at 10:20 pm

    Implement a Pointcut. In Castle Windsor this is done by implementing the IModelInterceptorsSelector interface.

    It would go something like this:

    public class JournalPointcut : IModelInterceptorsSelector
    {
        public bool HasInterceptors(ComponentModel model)
        {
            return true; // intercept everything - probably not a good idea, though
        }
    
        public InterceptorReference[] SelectInterceptors(
            ComponentModel model, InterceptorReference[] interceptors)
        {
            return new[] 
            {
                InterceptorReference.ForType<JournalInterceptor>()
            }.Concat(interceptors).ToArray();
        }
    }
    

    Then register the Interceptor and the Pointcut with the container:

    this.container.Register(Component.For<JounalInterceptor>());
    
    this.container.Kernel.ProxyFactory.AddInterceptorSelector(new JournalPointcut());
    

    For in-depth explanation, you may want to see this recording.

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

Sidebar

Related Questions

I'm trying to configure a web application that can use client-side JavaScript for localization
I'm trying to configure Ehcache (version 2.5) such that it never forgets items. I'm
I am trying to configure NHibernate on my console application in which I am
I'm trying to configure a dedicated server that runs ASP.NET to send mail through
I'm trying to configure Apache to allow read only access and ask for user
I'm trying to recompile application, that compiles fine with warning level 4 in visual
I'm trying to configure an ejb3 sample application, it's entities where mapped to postgres
In our WCF application I am trying to configure reliable sessions. Service: <wsHttpBinding> <binding
I'm trying to configure my application in facebook but I have a trouble. My
I am trying to configure Spring Security in my simple application. Here is my

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.