Logo Search packages:      
Sourcecode: ndoc version File versions  Download package

bool NDoc::Core::Reflection::ReflectionEngine::CheckForPropertyBacker ( XmlWriter  writer,
string  memberName,
Type  type 
) [inline, private]

This checks whether a field is a property backer, meaning it stores the information for the property.

This takes advantage of the fact that most people have a simple convention for the names of the fields and the properties that they back. If the field doesn't have a summary already, and it looks like it backs a property, and the BaseDocumenterConfig property is set appropriately, then this adds a summary indicating that.

Note that this design will call multiple fields the backer for a single property.

This also will call a public field a backer for a property, when typically that wouldn't be the case.

writer The XmlWriter to write to.
memberName The full name of the field.
type The Type which contains the field and potentially the property.
True only if a property backer is auto-documented.

Definition at line 3529 of file ReflectionEngine.cs.

                  if (!this.rep.AutoPropertyBackerSummaries) return false;

                  // determine if field is non-public
                  // (because public fields are probably not backers for properties)
                  bool isNonPublic = true; // stubbed out for now

                  //check whether or not we have a valid summary
                  bool isMissingSummary = true;
                  string xmldoc = assemblyDocCache.GetDoc(memberName);
                  if (xmldoc != null)
                        XmlTextReader reader = new XmlTextReader(xmldoc, XmlNodeType.Element, null);
                        while (reader.Read()) 
                              if (reader.NodeType == XmlNodeType.Element) 
                                    if (reader.Name == "summary") 
                                          string summarydetails = reader.ReadInnerXml();
                                          if (summarydetails.Length > 0 && !summarydetails.Trim().StartsWith("Summary description for"))
                                                isMissingSummary = false;

                  // only do this if there is no summary already
                  if (isMissingSummary && isNonPublic)
                        // find the property (if any) that this field backs

                        // generate the possible property names that this could back
                        // so far have: property Name could be backed by _Name or name
                        // but could be other conventions
                        string[] words = memberName.Split('.');
                        string fieldBaseName = words[words.Length - 1];
                        string firstLetter = fieldBaseName.Substring(0, 1);
                        string camelCasePropertyName = firstLetter.ToUpper() 
                              + fieldBaseName.Remove(0, 1);
                        string usPropertyName = fieldBaseName.Replace("_", "");

                        // find it
                        PropertyInfo propertyInfo;

                        if (((propertyInfo = FindProperty(camelCasePropertyName, 
                              type)) != null)
                              || ((propertyInfo = FindProperty(usPropertyName, 
                              type)) != null))
                              WritePropertyBackerDocumentation(writer, "summary", 
                              return true;
                  return false;

Generated by  Doxygen 1.6.0   Back to index