public static SummaryComment Parse(string str) { if (string.IsNullOrEmpty(str)) { return(new SummaryComment()); } XDocument doc = XDocument.Parse(str); var summary = doc.Descendants("summary").FirstOrDefault(); var paramList = doc.Descendants("param"); var sc = new SummaryComment(); sc.Summary = Edit(summary?.Value ?? string.Empty); List <ParamComment> pcs = new List <ParamComment>(); foreach (var param in paramList) { var name = param.Attribute("name"); if (name == null) { continue; } var pc = new ParamComment(); pc.Name = Edit(name.Value); pc.Comment = Edit(param.Value); pcs.Add(pc); } sc.ParamComments = pcs.ToArray(); return(sc); }
/// <summary> /// Initializes a new instance of the <see cref="DocumentedParameter"/> class. /// </summary> /// <param name="definition">The parameter definition.</param> /// <param name="comment">The parameter comment.</param> /// <param name="metadata">The associated metadata.</param> public DocumentedParameter(ParameterDefinition definition, ParamComment comment, IDocumentationMetadata metadata) : base(MemberClassification.Parameter, null, null, null, metadata) { _definition = definition; _comment = comment; _isOutParameter = definition.IsOut; _isRefParameter = definition.ParameterType is ByReferenceType; }
public void ORA_ReservedNameComment_Test() { using (var db = OpenDbConnection()) { DropAndCreateTables(db); var row = new ParamComment { Comment = 1, Id = 2 }; db.Insert(row); row.Comment = 454; db.Update(row); } }
private static DocumentedMethod MapMethod(IMethodInfo method, XmlDocumentationModel xmlModel) { var parameters = new List <DocumentedParameter>(); SummaryComment summary = null; RemarksComment remarks = null; IEnumerable <ExampleComment> examples = null; ReturnsComment returns = null; // Get the documentation for the type. var member = xmlModel.Find(method.Identity); if (member != null) { // Get the comments for the type. summary = member.Comments.OfType <SummaryComment>().FirstOrDefault(); remarks = member.Comments.OfType <RemarksComment>().FirstOrDefault(); examples = member.Comments.OfType <ExampleComment>(); returns = member.Comments.OfType <ReturnsComment>().FirstOrDefault(); } // Map parameters. foreach (var parameterDefinition in method.Definition.Parameters.ToList()) { ParamComment comment = null; if (member != null) { // Try to get the comment for the current parameter. comment = member.Comments.OfType <ParamComment>().FirstOrDefault(x => x.Name == parameterDefinition.Name); } var parameter = new DocumentedParameter(parameterDefinition, comment, method.Metadata); parameters.Add(parameter); } var metadata = method.Metadata; bool isPropertyAlias; if (method.Definition.IsCakeAlias(out isPropertyAlias)) { metadata = new AliasMetadataAdapter(metadata, isPropertyAlias); } return(new DocumentedMethod(method, parameters, summary, remarks, examples, returns, metadata)); }
private static DocumentedMethod MapMethod(IMethodInfo method, XmlDocumentationModel xmlModel) { var parameters = new List <DocumentedParameter>(); SummaryComment summary = null; RemarksComment remarks = null; ExampleComment example = null; ReturnsComment returns = null; // Get the documentation for the type. var member = xmlModel.Find(method.Identity); if (member != null) { // Get the comments for the type. summary = member.Comments.OfType <SummaryComment>().FirstOrDefault(); remarks = member.Comments.OfType <RemarksComment>().FirstOrDefault(); example = member.Comments.OfType <ExampleComment>().FirstOrDefault(); returns = member.Comments.OfType <ReturnsComment>().FirstOrDefault(); } // Map parameters. foreach (var parameterDefinition in method.Definition.Parameters.ToList()) { ParamComment comment = null; if (member != null) { // Try to get the comment for the current parameter. comment = member.Comments.OfType <ParamComment>().FirstOrDefault(x => x.Name == parameterDefinition.Name); } var parameter = new DocumentedParameter(parameterDefinition, comment); parameters.Add(parameter); } return(new DocumentedMethod(method, parameters, summary, remarks, example, returns)); }
public override void VisitParam(ParamComment comment, StringBuilder context) { context.AppendFormat("<param name=\"{0}\">", comment.Name); base.VisitParam(comment, context); context.Append("</param>"); }
/// <summary> /// Visits a <c>param</c> comment. /// </summary> /// <param name="comment">The comment.</param> /// <param name="context">The context.</param> public virtual void VisitParam(ParamComment comment, TContext context) { VisitChildren(comment, context); }