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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:50:24+00:00 2026-06-04T00:50:24+00:00

I’ve got several components registered in my container and Windsor can inject them without

  • 0

I’ve got several components registered in my container and Windsor can inject them without problems.
Now I’ve added a new registration for NHibernate ISessionFactory in this way:

foreach (KeyValuePair<string, string> _tenantItem in _contextWrapper.TenantsConnectionStrings)
        {
            var config = Fluently.Configure()
                .Database(
                    MsSqlConfiguration.MsSql2008
                    .UseOuterJoin()
                    .ConnectionString(_tenantItem.Value)
                    .FormatSql()
                    .ShowSql()
                )

                .ExposeConfiguration(ConfigurePersistence)
                .ProxyFactoryFactory(typeof(ProxyFactoryFactory))
                .BuildConfiguration();

            Kernel.Register(
                Component.For<ISessionFactory>()
                    .UsingFactoryMethod(config.BuildSessionFactory)
                    .Named(_tenantItem.Key)
                    .LifestyleTransient()
                    );
        }

Now if I try to inspect my container I see:

enter image description here

Component Implementation is “Late bound” and Windsor won’t inject it.

What’s wrong? What I can check?

  • 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-06-04T00:50:25+00:00Added an answer on June 4, 2026 at 12:50 am

    It probably doesn’t like that you are creating your config instance at runtime.

    You would be better off creating a proper class for your config, registering it with the container, and using that to create ISessionFactory instance.

    public class MySessionFactoryBuilder : IMySessionFactoryBuilder
    {
        private FluentConfiguration _fluentConfiguration = null;
    
        public MySessionFactoryBuilder()
        {
        }
    
        void Initialize(string connectionStringKey)
        {
            IPersistenceConfigurer persistenceConfigurer = null;
    
            persistenceConfigurer = MsSqlConfiguration.MsSql2008
                    .UseOuterJoin()
                    .ConnectionString(connectionStringKey)
                    .FormatSql()
                    .ShowSql()
                    ;
    
            _fluentConfiguration = Fluently.Configure()
                .Database(persistenceConfigurer)
                .ExposeConfiguration(ConfigurePersistence)
                .ProxyFactoryFactory(typeof(ProxyFactoryFactory))
                .BuildConfiguration()
                ;
        }
    
        public ISessionFactory BuildSessionFactory(string connectionStringKey)
        {
            Initialize(connectionStringKey);
            return _fluentConfiguration.BuildSessionFactory();
        }
    
    }
    

    You can have that registered normally. Then you register multiple ISessionFactory, one per tenant, in your installer loop:

    foreach (KeyValuePair<string, string> _tenantItem in _contextWrapper.TenantsConnectionStrings)
    {
    
        container.Register(
        Component.For<ISessionFactory>()
            .UsingFactoryMethod(k => k.Resolve<MySessionFactoryBuilder>().BuildSessionFactory(_tenantItem.Value))
            .Named(_tenantItem.Key),
    
        Component.For<ISession>()
            .UsingFactoryMethod(k => k.Resolve<ISessionFactory>().OpenSession())
            .Named(_tenantItem.Key + "-nhsession")
            .LifeStyle.Transient
            );
    
    }
    

    Note, i registered ISession transient, but not ISessionFactory. Normally you want to keep your ISessionFactory as long as possible, as it is expensive to create.

    I haven’t tested it, but i’m guessing that will resolve it, as the implementation of the session factory builder is known at compile-time.

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
i got an object with contents of html markup in it, for example: string
Does anyone know how can I replace this 2 symbol below from the string
I have just tried to save a simple *.rtf file with some websites and

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.