try the following:
container.Register( Component.For<ISessionFactory>() .UsingFactoryMethod(() => GetSessionFactory("1")) .Named("1"), Component.For<ISessionFactory>() .UsingFactoryMethod(() => GetSessionFactory("2")) .Named("2"), Component.For<IRepository>() .ImplementedBy<Repository>() .DependsOn(Dependency.OnComponent(typeof(ISessionFactory),"1")), Component.For<IReadOnlyRepository>() .ImplementedBy<ReadOnlyRepository>() .DependsOn(Dependency.OnComponent(typeof(ISessionFactory), "2")));
source share