protected void SaveStrings(string collectionKey, IEnumerable<string> items) { var collection = _db.GetCollection<StringCollectionWrapper>(LISTS_IDENTIFIER); var wrapper = collection.Find(w => w.Key == collectionKey).SingleOrDefault(); if (wrapper == null) { wrapper = new StringCollectionWrapper(collectionKey, items); collection.Insert(wrapper); } else { wrapper.Strings = items.ToArray(); collection.Update(wrapper); } }
protected void SaveStrings(string collectionKey, IEnumerable <string> items) { var collection = this._db.GetCollection <StringCollectionWrapper>(LISTS_IDENTIFIER); var wrapper = collection.Find(w => w.Key == collectionKey).SingleOrDefault(); if (wrapper == null) { wrapper = new StringCollectionWrapper(collectionKey, items); collection.Insert(wrapper); } else { wrapper.Strings = items.ToArray(); collection.Update(wrapper); } }