public void CanUseServerPrefix() { using (var store = NewDocumentStore()) { store.DatabaseCommands.Put( "Raven/Hilo/Users", null, new RavenJObject { { "Max", 32 } }, new RavenJObject()); store.DatabaseCommands.Put( "Raven/ServerPrefixForHilo", null, new RavenJObject { { "ServerPrefix", "2," } }, new RavenJObject()); var hiLoKeyGenerator = new HiLoKeyGenerator("Users", 32); var generateDocumentKey = hiLoKeyGenerator.GenerateDocumentKey(store.DatabaseCommands, new DocumentConvention(), new User()); Assert.Equal("Users/2,33", generateDocumentKey); } }
private int GenerateChangeSequence() { string id = changeSequenceHiLoKeyGenerator.GenerateDocumentKey( documentStore.DatabaseCommands, documentStore.Conventions, null); string identityPartsSeparator = documentStore.Conventions.IdentityPartsSeparator; int lastIndexOf = id.LastIndexOf(identityPartsSeparator, StringComparison.Ordinal); return(int.Parse(id.Substring(lastIndexOf + 1))); }
private void GenerateId(EventStream eventStream, AggregateRoot aggregate) { string typeTagName = documentStore.Conventions.GetTypeTagName(aggregate.GetType()); string id = eventStreamsHiLoKeyGenerator.GenerateDocumentKey( documentStore.DatabaseCommands, documentStore.Conventions, eventStream); string identityPartsSeparator = documentStore.Conventions.IdentityPartsSeparator; int lastIndexOf = id.LastIndexOf(identityPartsSeparator, StringComparison.Ordinal); eventStream.Id = string.Format( "EventStreams{2}{0}{2}{1}", typeTagName, id.Substring(lastIndexOf + 1), identityPartsSeparator); }
private long GetNextSequenceNumber() { return(long.Parse(_hiLoGen.GenerateDocumentKey(_store.DatabaseCommands, HiLoConvention, null))); }
private long GetNextSequenceNumber() { return(long.Parse(_hiLoGen.GenerateDocumentKey(HiLoConvention, null))); }