Esempio n. 1
0
        protected virtual void WriteJsonContentTranslationVersion(JsonWriter writer, object value, JsonSerializer serializer, Content content, Content.ContentTranslationVersion contentTranslationVersion)
        {
            writer.WriteStartObject();

            writer.WritePropertyName("CreationDate");
            serializer.Serialize(writer, contentTranslationVersion.CreationDate);
            WriteJsonContentInfo(writer, value, serializer, content);

            WriteJsonPublicationInfo(writer, value, serializer, contentTranslationVersion.Publication);

            writer.WritePropertyName("CultureName");
            serializer.Serialize(writer, contentTranslationVersion.Culture.Name);
            var propertyDictionary = contentTranslationVersion.Properties.Select(contentTranslationVersionProperty =>
                                                                                 WriteJsonContentTranslationVersionProperty(writer, value, serializer, content, contentTranslationVersion,
                                                                                                                            contentTranslationVersionProperty)).ToDictionary(propertyKeyValue =>
                                                                                                                                                                             propertyKeyValue.Key, propertyKeyValue => propertyKeyValue.Value);


            writer.WritePropertyName("PropertyDictionary");

            writer.WriteStartObject();

            foreach (var propertyKeyValue in propertyDictionary)
            {
                writer.WritePropertyName(propertyKeyValue.Key);
                serializer.Serialize(writer, propertyKeyValue.Value);
            }

            writer.WriteEndObject();

            writer.WriteEndObject();
        }
Esempio n. 2
0
        //Tres important !!!
        //TODO: http://ayende.com/blog/66563/ravendb-migrations-rolling-updates
        protected virtual KeyValuePair <string, Guid> WriteJsonContentTranslationVersionProperty(JsonWriter writer, object value,
                                                                                                 JsonSerializer serializer, Content content, Content.ContentTranslationVersion contentTranslationVersion,
                                                                                                 ContentTranslationVersionProperty contentTranslationVersionProperty)
        {
            writer.WritePropertyName(contentTranslationVersionProperty.ContentTypeProperty.Name);

            if (contentTranslationVersionProperty.SerializedValue == null)
            {
                writer.WriteNull();
            }
            else
            {
                var json = contentTranslationVersionProperty.SerializedValue;
                writer.WriteRawValue(json);
            }

            return(new KeyValuePair <string, Guid>(contentTranslationVersionProperty.ContentTypeProperty.Name, contentTranslationVersionProperty.ContentTypeProperty.Id));
        }