本文整理汇总了C#中Couchbase.Lite.Database.GetChanges方法的典型用法代码示例。如果您正苦于以下问题:C# Database.GetChanges方法的具体用法?C# Database.GetChanges怎么用?C# Database.GetChanges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Couchbase.Lite.Database
的用法示例。
在下文中一共展示了Database.GetChanges方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Changed
public virtual void Changed(Database.ChangeEvent @event)
{
IList<DocumentChange> changes = @event.GetChanges();
foreach (DocumentChange change in changes)
{
RevisionInternal rev = change.GetAddedRevision();
NUnit.Framework.Assert.IsNotNull(rev);
NUnit.Framework.Assert.IsNotNull(rev.GetDocId());
NUnit.Framework.Assert.IsNotNull(rev.GetRevId());
NUnit.Framework.Assert.AreEqual(rev.GetDocId(), rev.Properties["_id"]);
NUnit.Framework.Assert.AreEqual(rev.GetRevId(), rev.Properties["_rev"]);
}
}
示例2: Changed
public void Changed(Database.ChangeEvent @event)
{
NUnit.Framework.Assert.AreEqual(1, @event.GetChanges().Count);
DocumentChange change = @event.GetChanges()[0];
NUnit.Framework.Assert.AreEqual(DocumentId, change.GetDocumentId());
NUnit.Framework.Assert.AreEqual(conflictRev.GetRevId(), change.GetRevisionId());
NUnit.Framework.Assert.IsTrue(change.IsCurrentRevision());
NUnit.Framework.Assert.IsTrue(change.IsConflict());
Document doc = this._enclosing.database.GetDocument(change.GetDocumentId());
NUnit.Framework.Assert.AreEqual(conflictRev.GetRevId(), doc.GetCurrentRevisionId(
));
try
{
NUnit.Framework.Assert.AreEqual(2, doc.GetConflictingRevisions().Count);
NUnit.Framework.Assert.AreEqual(3, doc.GetRevisionHistory().Count);
}
catch (CouchbaseLiteException ex)
{
Assert.Fail("CouchbaseLiteException in change listener: " + ex.ToString());
}
}
示例3: Changed
public void Changed(Database.ChangeEvent @event)
{
IList<DocumentChange> changes = @event.GetChanges();
foreach (DocumentChange change in changes)
{
// Skip revisions that originally came from the database I'm syncing to:
Uri source = change.GetSourceUrl();
if (source != null && source.Equals(remote))
{
return;
}
RevisionInternal rev = change.GetAddedRevision();
IDictionary<string, object> paramsFixMe = null;
// TODO: these should not be null
if (GetLocalDatabase().RunFilter(filter, paramsFixMe, rev))
{
AddToInbox(rev);
}
}
}