Raven.Bundles.Replication.Responders.AttachmentReplicationResponder.IsDirectChildOfCurrentAttachment C# (CSharp) Method

IsDirectChildOfCurrentAttachment() private static method

private static IsDirectChildOfCurrentAttachment ( Raven.Abstractions.Data.Attachment existingAttachment, RavenJObject metadata ) : bool
existingAttachment Raven.Abstractions.Data.Attachment
metadata RavenJObject
return bool
		private static bool IsDirectChildOfCurrentAttachment(Attachment existingAttachment, RavenJObject metadata)
		{
			var version = new RavenJObject
			{
				{Constants.RavenReplicationSource, existingAttachment.Metadata[Constants.RavenReplicationSource]},
				{Constants.RavenReplicationVersion, existingAttachment.Metadata[Constants.RavenReplicationVersion]},
			};

			var history = metadata[Constants.RavenReplicationHistory];
			if (history == null) // no history, not a parent
				return false;

			if (history.Type != JTokenType.Array)
				return false;

			return history.Values().Contains(version, new RavenJTokenEqualityComparer());
		}