Note that there are some explanatory texts on larger screens.

plurals
  1. POManage multiple ravendb document stores through castle windsor in an MVC app?
    text
    copied!<p><em>I twist myself around a workable solution to use several databases in RavenDB for an ASP.Net MVC app using Castle Windsor for the wiring.</em></p> <h2>This is the current installer</h2> <pre><code>public class RavenInstaller : IWindsorInstaller { public void Install(IWindsorContainer container, IConfigurationStore store) { container.Register( Component.For&lt;IDocumentStore&gt;().Instance(CreateDocumentStore()).LifeStyle.Singleton, Component.For&lt;IDocumentSession&gt;().UsingFactoryMethod(GetDocumentSesssion).LifeStyle.PerWebRequest ); } static IDocumentStore CreateDocumentStore() { var store = new DocumentStore { ConnectionStringName = "RavenDb_CS9" }; store.Initialize(); IndexCreation.CreateIndexes(typeof(Users).Assembly, store); return store; } static IDocumentSession GetDocumentSesssion(IKernel kernel) { var store = kernel.Resolve&lt;IDocumentStore&gt;(); return store.OpenSession(); } } </code></pre> <p>The above works perfect <strong>but only for one Database</strong>.</p> <p>I can't find the proper thinking how to handle another database. The whole chain starts with a domain service asking for an <strong>IDocumentSession</strong>. Then the flow is as specified in the above installer. But where/how do I ask for a "SessionToDb1" or a "SessionToDb2"? </p> <p>The important is of course what connection string to use (where the DB property is specified) but also what indexes to create in respective DB / DocumentStore. </p> <p>Did anyone accomplish this using Windsor? Am I thinking/attacking it wrong here?</p> <p>Thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload