Exemple #1
0
 public virtual void Init()
 {
     using (var db = TrustchainDatabase.Open())
     {
         // Make sure that the in memory database exist
         db.CreateIfNotExist();
     }
 }
Exemple #2
0
 public void TestPut()
 {
     using (var db = TrustchainDatabase.Open())
     {
         Assert.IsTrue(db.KeyValue.Put("test", "test") == 1);
         Assert.IsTrue(db.KeyValue.Count() == 1);
     }
 }
Exemple #3
0
 public void TestDelete()
 {
     using (var db = TrustchainDatabase.Open())
     {
         Assert.IsTrue(db.KeyValue.Put("test", "test") == 1);
         Assert.IsTrue(db.KeyValue.Get("test") == "test");
         Assert.IsTrue(db.KeyValue.Delete("test") == 1);
         Assert.IsTrue(db.KeyValue.Get("test") == null);
         Assert.IsTrue(db.KeyValue.Count() == 0);
     }
 }
Exemple #4
0
 private IEnumerable <TrustModel> LoadSQLite(FileInfo info)
 {
     using (var db = TrustchainDatabase.Open(info.FullName))
     {
         var trusts = db.Trust.Select();
         foreach (var trust in trusts)
         {
             trust.Issuer.Subjects = db.Subject.Select(trust.TrustId).ToArray();
         }
         return(trusts);
     }
 }