title: Wiring up JOliver's EventStore using RavenDB Persistence Plugin
body: <p>I am evaluating <a href="https://github.com/joliver/EventStore">JOliver's EventStore</a> library. In particular, I am trying to use <a href="http://ravendb.net/">RavenDB</a> as the persistence engine for EventStore. EventStore comes with a plugin for this. NOTE: The database is empty with no indexes (other than the default ones).</p>
  
  <p>In wiring up the store, I used the following:</p>
  
  <pre><code>var store = Wireup.Init()
      .UsingRavenPersistence("EventStore", new DocumentObjectSerializer())
      .Build();
  </code></pre>
  
  <p>However, when I run my program, I get an exception that indicates the "RavenCommitByRevisionRange" index could not be found.</p>
  
  <p>In digging around the EventStore code, I think the problem happens to be that the RavenPersistenceEngine is not being initialized. The initialization code installs the needed indexes in the RavenDB server.</p>
  
  <p>On the SQL server side of things, I noticed that the wiring code in the example project shows a call to an extension method called: "InitializeStorageEngine". This extension method is tied to the class "PersistenceWireup". However, the extension method I'm using to wire in RavenDB persistence returns the class "Wireup". So I wrapped part of my wireup code in a new PersistenceWireup instance, and was able to call ".InitializeStorageEngine()" like so:</p>
  
  <pre><code>var store = new PersistenceWireup(
      Wireup.Init()
          .UsingRavenPersistence("EventStore", new DocumentObjectSerializer()))
              .InitializeStorageEngine()
          .Build();
  </code></pre>
  
  <p>This works great! The RavenDB database now contained the necessary indexes.</p>
  
  <p>So... My questions: Shouldn't ".UsingRavenPersistence(...)" return an instance of "PersistenceWireup" rather than simply "Wireup"? Or is there a better way to wire up RavenDB persistence in EventStore?</p>