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:

Component Implementation is “Late bound” and Windsor won’t inject it.
What’s wrong? What I can check?
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.
You can have that registered normally. Then you register multiple ISessionFactory, one per tenant, in your installer loop:
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.