GeoCache.Common.Repository.MongoRepository.GetCollection C# (CSharp) Méthode

GetCollection() private méthode

Get the collection from cache
private GetCollection ( string collectionName ) : MongoCollection
collectionName string Collection name
Résultat MongoCollection
        private MongoCollection GetCollection(string collectionName)
        {
            MongoCollection collection = null;
            if (!this._collections.TryGetValue(collectionName, out collection))
            {
                if (!this._database.CollectionExists(collectionName))
                {
                    this._database.CreateCollection(collectionName, null);
                }

                collection = this._database.GetCollection(collectionName);
                this._collections.Add(collectionName, collection);
                collection.EnsureIndex(
                    IndexKeys.GeoSpatial("coord"),
                    IndexOptions.SetGeoSpatialRange(-_indexRange, _indexRange));
            }

            return collection;
        }