示例#1
0
 /// <summary>
 /// Adds or updates the passed in JSON document
 /// </summary>
 public bool AddOrUpdateRecord(BsonRecord record, string collectionName)
 {
     return(AddOrUpdate(
                record.Id,
                record.Data,
                collectionName));
 }
示例#2
0
 /// <summary>
 /// Adds or updates a document in the collection
 /// </summary>
 /// <param name="id">The id of the document</param>
 /// <param name="item">
 /// The object that is being stored in the collection
 /// </param>
 public void AddOrUpdate(Guid id, T item)
 {
     if (this.Format == StorageFormat.BSON)
     {
         var record = new BsonRecord
         {
             Id   = id,
             Data = Serializer.SerializeBson <T>(item)
         };
         provider.AddOrUpdateRecord(record, this.Name);
     }
     else
     {
         var record = new JsonRecord
         {
             Id   = id,
             Data = Serializer.SerializeJson <T>(item)
         };
         provider.AddOrUpdateRecord(record, this.Name);
     }
 }
示例#3
0
 public bool AddOrUpdateRecord(BsonRecord record, string collectionName)
 {
     return(this.AddOrUpdateRecord(
                (IRecord <byte[]>)record,
                collectionName));
 }