async public Task <List <IDatasetElement> > Elements() { if (_layers != null) { return(_layers); } List <IDatasetElement> layers = new List <IDatasetElement>(); foreach (var collectionItem in await _spatialCollectionRef.Find <Json.SpatialCollectionItem>(_ => true).ToListAsync()) { layers.Add(new DatasetElement(await MongoDbFeatureClass.Create(this, collectionItem))); } _layers = layers; return(_layers); }
async public Task <IDatasetElement> Element(string title) { try { var collectionItem = await _spatialCollectionRef .Find <Json.SpatialCollectionItem>(c => c.Name == title) .FirstOrDefaultAsync(); if (collectionItem == null) { return(null); } return(new DatasetElement(await MongoDbFeatureClass.Create(this, collectionItem)) { Title = collectionItem.Name }); } catch (Exception ex) { this.lastException = ex; return(null); } }