public static IMutableAnnotatable HasExtendedProperty(IMutableAnnotatable annotatable, String key, String value) { var annotation = annotatable.FindAnnotation(nameof(ExtendedProperty)) ?? new Annotation(nameof(ExtendedProperty), "{}"); var annotationValues = JsonSerializer.Deserialize <Dictionary <String, String> >(annotation.Value as String); annotationValues.Add(key, value); annotatable.SetAnnotation(nameof(ExtendedProperty), JsonSerializer.Serialize(annotationValues)); return(annotatable); }
private static void SetComment(this IMutableAnnotatable annotatable, XPathNavigator navigator, MemberInfo memberInfo) { var comment = navigator.GetComment(memberInfo); if (!string.IsNullOrWhiteSpace(comment)) { annotatable.SetAnnotation("ClrComment", comment); } else { annotatable.RemoveAnnotation("ClrComment"); } }