Welcome back. Before I started creating domain classes, I set up document storage for my application. That meant going back to global.asax.cs and making more changes.
The first thing to do was adding a couple namespaces to the "using" section, namely Raven.Client and Raven.Client.Embedded. Next came creating a class variable, like the following...
public static IDocumentStore documentStore;
The last step was to instantiate documentStore and initialize it in Application_Start...
documentStore = new EmbeddableDocumentStore { ConnectionStringName = "RavenDB", UseEmbeddedHttpServer = true };
documentStore.Conventions.IdentityPartsSeparator = "-"; // so Raven IDs are web-friendly
documentStore.Initialize();
The boolean member of the constructor tells C# to enable Raven Studio, the Silverlight database administration system. IdentityPartsSeparator had to be set because Raven puts a "/" character in generated document IDs by default. You basically need two things to access Raven in code, namely an initialized document store and an "opened" IDocumentSession (more on the latter later).
In the next session, we'll set up the Model.
No comments:
Post a Comment