Example #1
0
 public void Delete(Expression <Func <MailHeaderEntity, bool> > predicate)
 {
     _mailHeaderEntity.Delete(predicate);
 }
Example #2
0
 /// <summary>
 /// Delete a single document on collection based on _id index.
 /// Returns true if document was deleted
 /// </summary>
 public Task <bool> DeleteAsync(City item)
 {
     return(Task.FromResult(cities.Delete(item.Id)));
 }
Example #3
0
 public virtual void RemoveItem(DocumentReference document)
 {
     LiteCollection.Delete(document.LiteDocument["_id"]);
     Items.Remove(document);
 }
Example #4
0
 public void Remove(Mediafile file)
 {
     tracks.Delete(file._id);
 }
Example #5
0
 public void Remove(Guid id) => words.Delete(x => x.Id == id);
Example #6
0
        public virtual T DeleteItemAsync(T item)
        {
            var c = _collection.Delete(i => i.Equals(item));

            return(item);
        }
Example #7
0
 /// <summary>
 /// Empties all expired entries that are in the Barrel.
 /// Throws an exception if any deletions fail and rolls back changes.
 /// </summary>
 public void EmptyExpired()
 {
     col.Delete(b => b.ExpirationDate < DateTime.UtcNow);
 }
Example #8
0
 public static void SaveMachines(List <Machine> machines)
 {
     machinesCollection.Delete(Query.All());
     machinesCollection.Insert(machines);
 }
Example #9
0
 public static void SaveMameInfo(MameInfo mameInfo)
 {
     mameInfoCollection.Delete(Query.All());
     mameInfoCollection.Insert(mameInfo);
 }
Example #10
0
 public bool Delete(BsonValue id)
 {
     DLiteUtil.Whisper(Name, "Delete", new object[] { id });
     return(LiteCollection.Delete(id));
 }
 public override void ClearLock(string lockName)
 {
     _fileLocks.Delete(fl => fl.Name == lockName);
 }
Example #12
0
 public void Delete(int id)
 {
     collection.Delete(x => x.Id == id);
 }
Example #13
0
 public bool DeleteItem(BsonValue item)
 {
     return(Collection.Delete(item));
 }
        /// <summary>
        /// Remove an entry from the database by unique slug/guild combo.
        /// </summary>
        /// <param name="db"></param>
        /// <param name="slug"></param>
        /// <param name="guild"></param>
        /// <returns></returns>
        public static int DeleteEntry(this LiteCollection <EmbedEntry> db, EmbedEntry entry)
        {
            var id = Hash(entry.Slug, entry.Guild);

            return(db.Delete(o => o.Id == id));
        }
 public bool DeleteSummary(Guid id)
 {
     return(_summaries.Delete(id));
 }
Example #16
0
 public bool DeleteId(int id)
 {
     return(collection.Delete(id));
 }
 public virtual Task <bool> DeleteAsync(TKey id, CancellationToken token = default)
 {
     return(Task.Run(() => _collection.Delete(new BsonValue(id)), token));
 }
Example #18
0
 public void Delete(int id)
 {
     _collection.Delete(id);
 }
Example #19
0
 public void DeleteDocument <T>(LiteCollection <T> collection, ObjectId id)
 {
     collection.Delete(id);
 }
 public Task Delete(WorkPermit entity)
 {
     return(Task.Run(() => _permitsCollection.Delete(entity.Id)));
 }
 private void RemoveAction(RemoveTodoAction action)
 {
     _todoCollection.Delete(action.Id);
 }
Example #22
0
 public override void DeleteFile(string name)
 {
     _fileMetaDataCollection.Delete(fm => fm.Name == name);
     _fileContenteCollection.Delete(fc => fc.Name == name);
 }
 public void Delete(Recipe recipe)
 => liteCollection.Delete(recipe.Id);
 private void ReleaseLocksByReleaseTimestamp()
 {
     _fileLocks.Delete(fl => fl.LockReleaseTimestamp < DateTime.UtcNow);
 }
Example #25
0
        /**
         *  Method that checks, for each record in the DB, if each file of the backup is actually present on the storage
         */
        public static void checkDBConsistency(string storagePath)
        {
            using (var db = new LiteDatabase(DB_PATH))
            {
                // Get a collection (or create, if doesn't exist)
                LiteCollection <BackupRecord> backupCollection = db.GetCollection <BackupRecord>(DB_BACKUPS);
                IEnumerable <BackupRecord>    backupList       = backupCollection.FindAll();

                // no backups on DB
                if (backupList.Count() <= 0)
                {
                    return;
                }

                foreach (BackupRecord record in backupList)
                {
                    List <myFileInfo> originalFileInfoList = record.fileInfoList;
                    List <myFileInfo> newFileInfoList      = new List <myFileInfo>();
                    //string clientID = record.userID;

                    foreach (myFileInfo fi in originalFileInfoList) // foreach file contained in the record
                    {
                        // compute the local file name
                        string localFileName = fi.TimeStamp + Path.GetExtension(fi.Name);

                        //fix for null relative path (file in root directory)
                        string relativePath = fi.RelativePath;
                        if (relativePath == null)
                        {
                            relativePath = "";
                        }

                        string localFilePath = Path.Combine(storagePath, record.userID.TrimStart(Path.DirectorySeparatorChar), relativePath.TrimStart(Path.DirectorySeparatorChar), fi.Name.TrimStart(Path.DirectorySeparatorChar), localFileName.TrimStart(Path.DirectorySeparatorChar));

                        // check if the file exists in the storage
                        if (File.Exists(localFilePath))
                        {
                            FileInfo f = new FileInfo(localFilePath);

                            if (fi.Size == f.Length)
                            {
                                newFileInfoList.Add(fi);
                            }
                            else
                            {
                                File.Delete(localFilePath);
                            }
                        }
                    }

                    //if newFileInfoList is empty then delete backupRecord
                    if (newFileInfoList.Count <= 0)
                    {
                        Console.WriteLine("DB: deleted record " + record.userID + " " + record.timestamp);
                        backupCollection.Delete(record.Id);
                        continue;
                    }

                    //if newFileInfoList is different from originalFileInfoList then update the BackupRecord on DB
                    if (newFileInfoList.Count < originalFileInfoList.Count)
                    {
                        Console.WriteLine("DB: updated record " + record.userID + " " + record.timestamp);
                        record.fileInfoList = newFileInfoList;
                        backupCollection.Update(record.Id, record);
                    }
                }
            }
        }
 public async Task DeleteItemAsync(Car item)
 {
     await Task.FromResult(cars.Delete(item.Id)).ConfigureAwait(false);
 }
Example #27
0
 /// <summary>
 /// Empties all expired entries that are in the Barrel.
 /// Throws an exception if any deletions fail and rolls back changes.
 /// </summary>
 public void EmptyExpired() => col.Delete(b => b.ExpirationDate.ToUniversalTime() < DateTime.UtcNow);
Example #28
0
        public void Delete <T>(Guid id)
        {
            LiteCollection <T> col = db.GetCollection <T>(collectionDiscoveryLogic.GetName <T>());

            col.Delete(id);
        }
Example #29
0
 public bool Delete(int id)
 {
     return(col.Delete(id));
 }
        private static void InitPlayers(LiteCollection <Player> collection)
        {
            // Delete previous data
            var allPlayers = collection.FindAll();

            foreach (var player in allPlayers)
            {
                collection.Delete(player.Id);
            }

            var player1 = new Player
            {
                Id        = 52,
                Firstname = "Novak",
                Lastname  = "Djokovic",
                Shortname = "N.DJO",
                Sex       = "M",
                Country   = new Country
                {
                    Picture = "https://i.eurosport.com/_iss_/geo/country/flag/medium/6944.png",
                    Code    = "SRB"
                },
                Picture = "https://i.eurosport.com/_iss_/person/pp_clubteam/large/565920.jpg",
                Data    = new Data
                {
                    Rank   = 2,
                    Points = 2542,
                    Weight = 80000,
                    Height = 188,
                    Age    = 31,
                    Last   = new List <long> {
                        1, 1, 1, 1, 1
                    }
                }
            };

            var player2 = new Player
            {
                Id        = 95,
                Firstname = "Venus",
                Lastname  = "Williams",
                Shortname = "V.WIL",
                Sex       = "F",
                Country   = new Country
                {
                    Picture = "https://i.eurosport.com/_iss_/person/pp_clubteam/large/136449.jpg",
                    Code    = "USA"
                },
                Picture = "https://i.eurosport.com/_iss_/person/pp_clubteam/large/136450.jpg",
                Data    = new Data
                {
                    Rank   = 52,
                    Points = 1105,
                    Weight = 74000,
                    Height = 185,
                    Age    = 38,
                    Last   = new List <long> {
                        0, 1, 0, 0, 1
                    }
                }
            };

            var player3 = new Player
            {
                Id        = 65,
                Firstname = "Stan",
                Lastname  = "Wawrinka",
                Shortname = "S.WAW",
                Sex       = "M",
                Country   = new Country
                {
                    Picture = "https://i.eurosport.com/_iss_/geo/country/flag/large/2213.png",
                    Code    = "SUI"
                },
                Picture = "https://i.eurosport.com/_iss_/person/pp_clubteam/large/325225.jpg",
                Data    = new Data
                {
                    Rank   = 21,
                    Points = 1784,
                    Weight = 81000,
                    Height = 183,
                    Age    = 33,
                    Last   = new List <long> {
                        1, 1, 1, 0, 1
                    }
                }
            };

            var player4 = new Player
            {
                Id        = 102,
                Firstname = "Serena",
                Lastname  = "Williams",
                Shortname = "S.WIL",
                Sex       = "F",
                Country   = new Country
                {
                    Picture = "https://i.eurosport.com/_iss_/geo/country/flag/medium/2209.png",
                    Code    = "USA"
                },
                Picture = "https://i.eurosport.com/_iss_/person/pp_clubteam/large/136450.jpg",
                Data    = new Data
                {
                    Rank   = 10,
                    Points = 3521,
                    Weight = 72000,
                    Height = 175,
                    Age    = 37,
                    Last   = new List <long> {
                        0, 1, 1, 1, 0
                    }
                }
            };

            var player5 = new Player
            {
                Id        = 17,
                Firstname = "Rafael",
                Lastname  = "Nadal",
                Shortname = "R.NAD",
                Sex       = "M",
                Country   = new Country
                {
                    Picture = "https://i.eurosport.com/_iss_/geo/country/flag/large/2203.png",
                    Code    = "ESP"
                },
                Picture = "https://i.eurosport.com/_iss_/person/pp_clubteam/large/435121.jpg",
                Data    = new Data
                {
                    Rank   = 1,
                    Points = 1982,
                    Weight = 85000,
                    Height = 185,
                    Age    = 33,
                    Last   = new List <long> {
                        1, 0, 0, 0, 1
                    }
                }
            };

            collection.Insert(player1);
            collection.Insert(player2);
            collection.Insert(player3);
            collection.Insert(player4);
            collection.Insert(player5);
        }