Exemplo n.º 1
0
 public bool DeleteEnvelope <T>(string filePath, string key)
 {
     lock (_thisLock)
     {
         try
         {
             FileDatabase database = _fileDatabaseIOController.Deserialize(filePath);
             database.BlobTable.Remove(key);
             _fileDatabaseIOController.Serialize(filePath, database);
             return(true);
         }
         catch (Exception ex)
         {
             throw new ApplicationException(ex.Message, ex);
         }
     }
 }
Exemplo n.º 2
0
 public T ReadEnvelope <T>(string filePath, string key)
 {
     lock (_thisLock)
     {
         try
         {
             FileDatabase database = _fileDatabaseIOController.Deserialize(filePath);
             string       data     = database.BlobTable[key];
             T            envelope = _marshaller.UnMarshall <T>(data);
             return((envelope == null) ? default(T) : envelope);
         }
         catch (Exception ex)
         {
             throw new ApplicationException(ex.Message, ex);
         }
     }
 }
Exemplo n.º 3
0
 public bool WriteEnvelope <T>(string filePath, string key, T envelope)
 {
     lock (_thisLock)
     {
         try
         {
             string       data         = _marshaller.MarshallPayloadJSON(envelope);
             FileDatabase fileDatabase = _fileDatabaseIOController.Deserialize(filePath);
             fileDatabase.BlobTable.Add(key, data);
             _fileDatabaseIOController.Serialize(filePath, fileDatabase);
             return(true);
         }
         catch (Exception ex)
         {
             throw new ApplicationException(ex.Message, ex);
         }
     }
 }