Ejemplo n.º 1
0
        public void UpdateDocumentFromJsonDocument()
        {
            Id       = document.Key;
            JsonData = PrepareRawJsonString(document.DataAsJson);

            IsProjection = string.IsNullOrEmpty(Id) && (document.Metadata == null);

            if (IsProjection)
            {
                return;
            }

            if (document.Metadata != null)
            {
                foreach (JProperty property in document.Metadata.Properties().ToList())
                {
                    if (property.Name.StartsWith("@"))
                    {
                        property.Remove();
                    }
                }
            }

            JsonMetadata = PrepareRawJsonString(document.Metadata);

            metadata = ParseJsonToDictionary(document.Metadata);

            LastModified              = document.LastModified;
            CollectionType            = DocumentViewModel.DetermineCollectionType(document.Metadata);
            ClrType                   = metadata.IfPresent <string>(Raven.Abstractions.Data.Constants.RavenClrType);
            Etag                      = document.Etag.ToString();
            NonAuthoritiveInformation = document.NonAuthoritiveInformation;
        }
Ejemplo n.º 2
0
        public void Initialize(JsonDocument doc)
        {
            document = doc;

            Id       = document.Key;
            JsonData = PrepareRawJsonString(document.DataAsJson);

            IsProjection = string.IsNullOrEmpty(Id) && (document.Metadata == null);

            if (IsProjection)
            {
                return;
            }

            JsonMetadata = PrepareRawJsonString(document.Metadata);

            metadata = ParseJsonToDictionary(document.Metadata);

            LastModified   = metadata.IfPresent <DateTime>("Last-Modified");
            CollectionType = DocumentViewModel.DetermineCollectionType(document.Metadata);
            ClrType        = metadata.IfPresent <string>("Raven-Clr-Type");
        }
Ejemplo n.º 3
0
        public void UpdateDocumentFromJsonDocument()
        {
            Id       = document.Key;
            JsonData = PrepareRawJsonString(document.DataAsJson);

            IsProjection = string.IsNullOrEmpty(Id) && (document.Metadata == null || document.Metadata.Any() == false);
            if (IsProjection)
            {
                return;
            }

            if (document.Metadata != null)
            {
                foreach (var property in document.Metadata.ToList())
                {
                    if (property.Key.StartsWith("@"))
                    {
                        document.Metadata.Remove(property.Key);
                    }
                }
            }

            JsonMetadata = PrepareRawJsonString(document.Metadata);

            metadata = ParseJsonToDictionary(document.Metadata);

            LastModified = document.LastModified ?? DateTime.MinValue;
            if (LastModified.Kind == DateTimeKind.Utc)
            {
                LastModified = LastModified.ToLocalTime();
            }
            CollectionType            = DocumentViewModel.DetermineCollectionType(document.Metadata);
            ClrType                   = metadata.IfPresent <string>(Constants.RavenClrType);
            Etag                      = document.Etag.ToString();
            NonAuthoritiveInformation = document.NonAuthoritiveInformation ?? false;
        }
Ejemplo n.º 4
0
		public void UpdateDocumentFromJsonDocument()
		{
			Id = document.Key;
			JsonData = PrepareRawJsonString(document.DataAsJson);

			IsProjection = string.IsNullOrEmpty(Id) && (document.Metadata == null);

			if (IsProjection) return;

			if (document.Metadata != null)
			{
				foreach (var property in document.Metadata.ToList())
				{
					if (property.Key.StartsWith("@"))
						document.Metadata.Remove(property.Key);
				}
			}

			JsonMetadata = PrepareRawJsonString(document.Metadata);

			metadata = ParseJsonToDictionary(document.Metadata);

			LastModified = document.LastModified;
			CollectionType = DocumentViewModel.DetermineCollectionType(document.Metadata);
			ClrType = metadata.IfPresent<string>(Raven.Abstractions.Data.Constants.RavenClrType);
			Etag = document.Etag.ToString();
			NonAuthoritiveInformation = document.NonAuthoritiveInformation;
		}
Ejemplo n.º 5
0
		public void UpdateDocumentFromJsonDocument()
		{
			Id = document.Key;
			JsonData = PrepareRawJsonString(document.DataAsJson);

			IsProjection = string.IsNullOrEmpty(Id) && (document.Metadata == null || document.Metadata.Any() == false);
			if (IsProjection) return;

			if (document.Metadata != null)
			{
				foreach (var property in document.Metadata.ToList())
				{
					if (property.Key.StartsWith("@"))
						document.Metadata.Remove(property.Key);
				}
			}

			JsonMetadata = PrepareRawJsonString(document.Metadata);

			metadata = ParseJsonToDictionary(document.Metadata);

			LastModified = document.LastModified ?? DateTime.MinValue;
			if (LastModified.Kind == DateTimeKind.Utc)
				LastModified = LastModified.ToLocalTime();
			CollectionType = DocumentViewModel.DetermineCollectionType(document.Metadata);
			ClrType = metadata.IfPresent<string>(Constants.RavenClrType);
			Etag = document.Etag.ToString();
			NonAuthoritiveInformation = document.NonAuthoritiveInformation ?? false;
		}
Ejemplo n.º 6
0
		public void Initialize(JsonDocument doc)
		{
			document = doc;

			Id = document.Key;
			JsonData = PrepareRawJsonString(document.DataAsJson);

			IsProjection = string.IsNullOrEmpty(Id) && (document.Metadata == null);

			if (IsProjection) return;

			JsonMetadata = PrepareRawJsonString(document.Metadata);

			metadata = ParseJsonToDictionary(document.Metadata);

			LastModified = metadata.IfPresent<DateTime>("Last-Modified");
			CollectionType = DocumentViewModel.DetermineCollectionType(document.Metadata);
			ClrType = metadata.IfPresent<string>("Raven-Clr-Type");
		}