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); } }
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)); } }