config.SetDocumentationProvider(new XmlDocumentationProvider( HttpContext.Current.Server.MapPath("~/App_Data/XmlDocument.xml")));
config.SetDocumentationProvider(new XmlDocumentationProvider( HttpContext.Current.Server.MapPath("~/App_Data")));
private List<XPathNavigator> _documentNavigators = new List<XPathNavigator>();
public XmlDocumentationProvider(string documentPath) { if (documentPath== null) { throw new ArgumentNullException("documentPath"); } var files = new[] { "XmlDocument.xml", "引用的類庫XML文件名.xml" }; foreach (var file in files) { XPathDocument xpath = new XPathDocument(Path.Combine(documentPath, file)); _documentNavigators.Add(xpath.CreateNavigator()); } }
private XPathNavigator SelectSingleNode(string selectExpression) { foreach (var navigator in _documentNavigators) { var propertyNode = navigator.SelectSingleNode(selectExpression); if (propertyNode != null) return propertyNode; } return null; }