CmisSync.Lib.Storage.Database.FileTransmissionStorage.RemoveObjectByRemoteObjectId C# (CSharp) Метод

RemoveObjectByRemoteObjectId() публичный Метод

public RemoveObjectByRemoteObjectId ( string remoteObjectId ) : void
remoteObjectId string
Результат void
        public void RemoveObjectByRemoteObjectId(string remoteObjectId) {
            if (remoteObjectId == null) {
                throw new ArgumentNullException("remoteObjectId");
            }

            if (string.IsNullOrEmpty(remoteObjectId)) {
                throw new ArgumentException("empty string", "remoteObjectId");
            }

            using (var tran = this.engine.GetTransaction()) {
                tran.RemoveKey(FileTransmissionObjectsTable, remoteObjectId);
                tran.Commit();
            }
        }

Usage Example

        public void RemoveObjectOnMultipleTimes() {
            var storage = new FileTransmissionStorage(this.engine);

            for (int i = 1; i <= 10; ++i) {
                this.remoteFile.Setup(m => m.Id).Returns("RemoteObjectId" + i.ToString());
                var obj = new FileTransmissionObject(TransmissionType.UPLOAD_NEW_FILE, this.localFile.Object, this.remoteFile.Object);
                Assert.DoesNotThrow(() => storage.SaveObject(obj));
                Assert.That(storage.GetObjectList().Count, Is.EqualTo(i));
                Assert.That(storage.GetObjectList().First(foo => foo.LocalPath == this.localFile.Object.FullName && foo.RemoteObjectId == "RemoteObjectId" + i.ToString()), Is.Not.Null);
            }

            for (int i = 1; i <= 10; ++i) {
                Assert.DoesNotThrow(() => storage.RemoveObjectByRemoteObjectId("RemoteObjectId" + i.ToString()));
                Assert.That(storage.GetObjectList().Count, Is.EqualTo(10 - i));
                Assert.Throws<InvalidOperationException>(() => storage.GetObjectList().First(foo => foo.LocalPath == this.localFile.Object.FullName && foo.RemoteObjectId == "RemoteObjectId" + i.ToString()));
            }
        }
All Usage Examples Of CmisSync.Lib.Storage.Database.FileTransmissionStorage::RemoveObjectByRemoteObjectId