Skip to content

Instantly share code, notes, and snippets.

@hyrmn
Created November 14, 2013 16:00
Show Gist options
  • Select an option

  • Save hyrmn/7469287 to your computer and use it in GitHub Desktop.

Select an option

Save hyrmn/7469287 to your computer and use it in GitHub Desktop.
wireup for ravendb + indexes in unit tests
static using_a_wired_environment()
{
DocumentStore = new EmbeddableDocumentStore
{
RunInMemory = true,
Conventions = { JsonContractResolver = new RavenContractResolver(true), MaxNumberOfRequestsPerSession = int.MaxValue, }
};
DocumentStore.Conventions.CustomizeJsonSerializer = jsonSerializer => { jsonSerializer.ConfigureForNodaTime(DateTimeZoneProviders.Bcl); };
DocumentStore.RegisterListener(new NoStaleQueriesAllowed());
DocumentStore.Initialize();
CreateDefaultIndexes(DocumentStore);
var idx1 = DocumentStore.DatabaseCommands.GetIndex("UserProjection/ByEmail");
var idx = DocumentStore.DatabaseCommands.GetIndex("PosItemProjection/ByCategoryId");
}
private static void CreateDefaultIndexes(IDocumentStore documentStore)
{
IndexCreation.CreateIndexes(typeof(UserProjection_ByEmail).Assembly, DocumentStore);
new RavenDocumentsByEntityName().Execute(documentStore);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment