public string GetCollectionName(string aggregateRootId) { var singleCollectionName = EntityName.EndsWith("s") ? EntityName : (EntityName + "s"); if (ShardCount <= 1) { return(string.Format(EventSingleCollectionNameFormat, singleCollectionName)); } var collectionNumber = GetCollectionNumber(aggregateRootId); return(string.Format(EventCollectionNameFormat, singleCollectionName, collectionNumber)); }
private void CreateIndex() { var singleCollectionName = EntityName.EndsWith("s") ? EntityName : (EntityName + "s"); if (ShardCount <= 1) { var collectionName = string.Format(EventSingleCollectionNameFormat, singleCollectionName); EnsureIndex(collectionName); } else { for (int i = 0; i < ShardCount; i++) { var collectionName = string.Format(EventCollectionNameFormat, singleCollectionName, i); EnsureIndex(collectionName); } } }