Пример #1
0
			public bool TryResolveConflict(string key, JsonDocument[] conflictedDocs, out JsonDocument resolvedDocument)
			{
				var maxDate = conflictedDocs.Max(x => x.LastModified);
				resolvedDocument = conflictedDocs.FirstOrDefault(x => x.LastModified == maxDate);

				return resolvedDocument != null;
			}
Пример #2
0
			public bool TryResolveConflict(string key, JsonDocument[] conflictedDocs, out JsonDocument resolvedDocument)
			{
				if (conflictedDocs == null || !conflictedDocs.Any())
				{
					resolvedDocument = null;
					return false;
				}

				if (key.StartsWith("Raven/"))
				{
					resolvedDocument = null;
					return false;
				}

				var maxDate = conflictedDocs.Max(x => x.Metadata.Value<DateTimeOffset>(Constants.RavenLastModified));

				resolvedDocument =
					conflictedDocs.FirstOrDefault(x => x.Metadata.Value<DateTimeOffset>(Constants.RavenLastModified) == maxDate);
				if (resolvedDocument != null)
				{
					// Do the logging before we override the metadata
					resolvedDocument.Metadata.Remove("@id");
					resolvedDocument.Metadata.Remove("@etag");
					resolvedDocument.Metadata.Remove(Constants.RavenReplicationConflict);
					resolvedDocument.Metadata.Remove(Constants.RavenReplicationConflictDocument);
				}

				return resolvedDocument != null;
			}
        public bool TryResolveConflict(string key, JsonDocument[] conflictedDocs, out JsonDocument resolvedDocument)
        {
            var maxDate = conflictedDocs.Max(x => x.LastModified);
            resolvedDocument = conflictedDocs
                                .FirstOrDefault(x => x.LastModified == maxDate);

            if (resolvedDocument == null)
                return false;

            resolvedDocument.Metadata.Remove("@id");
            resolvedDocument.Metadata.Remove("@etag");

            return true;
        }
Пример #4
0
 public bool TryResolveConflict(string key, JsonDocument[] conflictedDocs, out JsonDocument resolvedDocument)
 {
     var latestLastModified = conflictedDocs.Max(x => x.LastModified);
     resolvedDocument = conflictedDocs.First(x => x.LastModified == latestLastModified);
     resolvedDocument.Metadata.Remove("@id");
     resolvedDocument.Metadata.Remove("@etag");
     return true;
 }