Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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);
                }
            }
        }