public DatabaseCommandsFor ( string shardId ) : IDatabaseCommands | ||
shardId | string | |
Результат | IDatabaseCommands |
public string GenerateDocumentKey(DocumentConvention conventions, object entity) { var shardId = shardedDocumentStore.ShardStrategy.ShardResolutionStrategy.MetadataShardIdFor(entity); if (shardId == null) { throw new InvalidOperationException(string.Format( "ShardResolutionStrategy.MetadataShardIdFor cannot return null. You must specify where to store the metadata documents for the entity type '{0}'.", entity.GetType().FullName)); } MultiTypeHiLoKeyGenerator value; if (generatorsByShard.TryGetValue(shardId, out value)) { return(value.GenerateDocumentKey(conventions, entity)); } lock (this) { if (generatorsByShard.TryGetValue(shardId, out value) == false) { value = new MultiTypeHiLoKeyGenerator(shardedDocumentStore.DatabaseCommandsFor(shardId), capacity); generatorsByShard = new Dictionary <string, MultiTypeHiLoKeyGenerator>(generatorsByShard) { { shardId, value } }; } } return(value.GenerateDocumentKey(conventions, entity)); }