/// <summary> /// Is called when an entry is finished. /// </summary> public override async Task EndEntry() { if (this.entryType == EntryType.Clear) { await Database.Provider.Clear(this.collectionName); } else if (!(this.obj is null)) { GenericObject Obj2 = await Database.Provider.TryLoadObject <GenericObject>(this.collectionName, this.objectId); switch (this.entryType) { case EntryType.New: case EntryType.Update: if (Obj2 is null) { await Database.Provider.Insert(this.obj); } else if (!Obj2.Equals(this.obj)) { await Database.Provider.Update(this.obj); } break; case EntryType.Delete: if (!(Obj2 is null)) { await Database.Provider.Delete(Obj2); } break; } this.obj = null; this.nrObjectsInBulk++; if (this.nrObjectsInBulk >= 1000) { await Database.EndBulk(); await Database.StartBulk(); this.nrObjectsInBulk = 0; } } await base.EndEntry(); }