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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:18:30+00:00 2026-05-25T10:18:30+00:00

I have a large existing solution with multiple tiers that uses CastleWindsor as a

  • 0

I have a large existing solution with multiple tiers that uses CastleWindsor as a DI framework for the newer layers/projects. I am currently trying to implement some new functionality in a layer/project that has no previous DI in place but I keep getting “circular refernce” problems.

Given a solution like this…

  • MyCompany.Core – includes CastleWindsorConfiguration
  • MyCompany.BusinessLayer – includes entities & business logic
  • MyCompany.Data – includes NHibernate mapping & repositories
  • MyCompany.Emails – existsing non DI functionality to complement the BusinessLayer
  • MyCompany.Web – Web app fron end/display

In reality there are actually quite a few BusinessLayer supplimentry projects/layers

I cannot add a reference to MyCompany.Core in MyCompany.Emails because the CastleWindsor container in Core references the Emails project so it can be configured/mapped with the following…

_windsorContainer.Register(Component.For<IEMailPoolHandler>().ImplementedBy(typeof(EMailPoolHandler)).LifeStyle.PerWebRequest);

But I then need to resolve this dependency in the Emails project with something like the following…

private IEMailPoolHandler EMailPoolHandler
{
    get
    {
        return MyCompany.Core.WindsorContainer.Resolve<IEMailPoolHandler>();
    }
}

And here I get the circular reference error. Basically I cant reference Core because it references Emails.

So, the question really is, what is the best way to handle this kind of situation and where should I have my CastleWindsor Container? Or is it ok to have more than one? For example one in each project?

  • 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-25T10:18:31+00:00Added an answer on May 25, 2026 at 10:18 am

    You should put it in the .Web project. I believe it’s the project that is the actual application -controls lifetime and overall configuration – that should configure, instantiate and resolve from the container.

    Then you should – if at all possible – inject (ctor or setter, automatically or manually) either the EmailPoolHandler or an EmailPoolHandlerFactory into the classes in the Email project, not access the container from there.

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

Sidebar

Related Questions

Some colleagues of mine have a large Java web app that uses a search
I'm having issues getting UpdatePanel working in a large, existing solution. I have a
I have a large existing application with a bunch of managed-beans that are injected
We have a very large existing site that we're going to do a completely
We have started using the boost unit testing library for a large existing code
I have an existing program we've developed as a large set of Eclipse plugins.
I have large batches of XHTML files that are manually updated. During the review
I'm developing a website in PHP and I have large JS files that I
I'm trying to create a faster query, right now i have large databases. My
I have a requirement for compiling large number of projects (some of them having

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.