public T Load(IDictionary <string, object> @params) { // build up the query IMongoQuery[] q = new IMongoQuery[@params.Keys.Count]; int idx = 0; foreach (var de in @params) { // MongoDb maps 'Id' to '_id' string key = de.Key; // ugly fix if (key == "Id") { key = "_id"; } q[idx++] = Query.EQ(key, BsonTypeMapper.MapToBsonValue(de.Value)); } var mongoQ = Query.And(q); var result = Collecton.FindOneAs <T>(mongoQ); return(result); }
public void Remove(T state) { var q = Query.EQ("_id", BsonTypeMapper.MapToBsonValue(state.Id)); Collecton.Remove(q); }
public void Save(T state) { Collecton.Save(state); }
public void Save(T model) { Collecton.Save(model); }