コード例 #1
0
        private static void WriteValidateFunction(JsonWriter writer, IDesignDocument doc)
        {
            var validateProperty = doc.GetType().GetTypeInfo().GetProperty("ValidateDocUpdate");

            if (validateProperty != null)
            {
                WriteProperty(writer, "validate_doc_update", ((FunctionSpec)validateProperty.GetValue(doc)).Content);
            }
        }
コード例 #2
0
        private static void WriteSection <TSectionInterface>(IDesignDocument doc, string sectionName, JsonWriter writer, JsonSerializer serializer)
        {
            var sectionType = doc.GetType().GetTypeInfo().GetNestedTypes().SingleOrDefault(t => t.ImplementsInterface(typeof(TSectionInterface)));

            if (sectionType != null)
            {
                writer.WritePropertyName(sectionName);
                serializer.Serialize(writer, ReflectSectionFunctions(sectionType));
            }
        }
コード例 #3
0
 public static string Serialize(IDesignDocument designDocument)
 {
     return(JsonConvert.SerializeObject(designDocument, Formatting.Indented, new DesignDocumentSerializerSettings()));
 }