Skip to content

Instantly share code, notes, and snippets.

@kijanawoodard
Created November 13, 2012 17:01
Show Gist options
  • Select an option

  • Save kijanawoodard/4067001 to your computer and use it in GitHub Desktop.

Select an option

Save kijanawoodard/4067001 to your computer and use it in GitHub Desktop.
var connectionString = ConfigurationManager.AppSettings[connectionStringName];
var parser = ConnectionStringParser<RavenConnectionStringOptions>.FromConnectionString(connectionString);
parser.Parse();
var documentStore = new DocumentStore
{
ApiKey = parser.ConnectionStringOptions.ApiKey,
Url = parser.ConnectionStringOptions.Url,
};
var generator = new MultiTypeHiLoKeyGenerator(documentStore, 32);
documentStore.Conventions.DocumentKeyGenerator = entity =>
{
var special = entity as IGenerateMyId;
return special == null ? generator.GenerateDocumentKey(documentStore.Conventions, entity) : special.GenerateId();
};
documentStore.Initialize();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment