public void GenerateDocForEntryPoint(ContainerRegistration apiEntryPointRegistration, IEnumerable <IApiMethodCall> apiMethodCalls) { //Find the document string docFile = Path.Combine(LookupDir, Path.GetFileName(apiEntryPointRegistration.MappedToType.Assembly.Location).ToLowerInvariant().Replace(".dll", ".xml")); if (!File.Exists(docFile)) { //Build without doc BuildUndocumented(apiEntryPointRegistration, apiMethodCalls); return; } var members = XDocument.Load(docFile).Root.ThrowIfNull(new ArgumentException("Bad documentation file " + docFile)).Element("members").Elements("member"); //Find entry point first var entryPointDoc = members.SingleOrDefault(x => x.Attribute("name").ValueOrNull() == string.Format("T:{0}", apiEntryPointRegistration.MappedToType.FullName)); if (entryPointDoc == null) { entryPointDoc = new XElement("member", new XElement("summary", "This entry point doesn't have documentation."), new XElement("remarks", "")); } var methodCallsDoc = from apiMethodCall in apiMethodCalls let memberdesc = (from member in members where member.Attribute("name").ValueOrNull() == GetMethodString(apiMethodCall.MethodCall) select member).SingleOrDefault() select new { apiMethod = apiMethodCall, description = memberdesc ?? CreateEmptyParams(apiMethodCall) }; //Ughh. we got all what we need now building var root = new MsDocEntryPoint { Summary = entryPointDoc.Element("summary").ValueOrNull(), Remarks = entryPointDoc.Element("remarks").ValueOrNull(), Name = apiEntryPointRegistration.Name, Example = entryPointDoc.Element("example").ValueOrNull(), Methods = (from methodCall in methodCallsDoc let pointMethod = new MsDocEntryPointMethod { Path = methodCall.apiMethod.FullPath, HttpMethod = methodCall.apiMethod.HttpMethod, Authentification = methodCall.apiMethod.RequiresAuthorization, FunctionName = GetFunctionName(methodCall.apiMethod.MethodCall.Name), Summary = methodCall.description.Element("summary").ValueOrNull(), Visible = string.IsNullOrEmpty(methodCall.description.Element("visible").ValueOrNull()), Remarks = methodCall.description.Element("remarks").ValueOrNull(). Replace(Environment.NewLine, @"<br />"), Returns = methodCall.description.Element("returns").ValueOrNull(), Example = methodCall.description.Element("example").ValueOrNull(). Replace(Environment.NewLine, @"<br />"), Response = TryCreateResponce(methodCall.apiMethod, Container, methodCall.description.Element("returns")), Category = methodCall.description.Element("category").ValueOrNull(), Notes = methodCall.description.Element("notes").ValueOrNull(), ShortName = methodCall.description.Element("short").ValueOrNull(), Params = (from methodParam in methodCall.description.Elements("param") select new MsDocEntryPointMethodParams { Description = methodParam.ValueOrNull(), Name = methodParam.Attribute("name"). ValueOrNull(), Remarks = methodParam.Attribute("remark"). ValueOrNull(), IsOptional = string.Equals(methodParam.Attribute("optional").ValueOrNull(), bool.TrueString, StringComparison.OrdinalIgnoreCase), Visible = !string.Equals(methodParam.Attribute("visible").ValueOrNull(), bool.FalseString, StringComparison.OrdinalIgnoreCase), Type = methodCall.apiMethod.GetParams() .Where( x => x.Name == methodParam.Attribute("name") .ValueOrNull()) .Select(x => GetParameterTypeRepresentation(x.ParameterType)) .SingleOrDefault(), Method = GuesMethod( methodParam.Attribute("name"). ValueOrNull(), methodCall.apiMethod.RoutingUrl, methodCall.apiMethod.HttpMethod) }).ToList() } where pointMethod.Visible select pointMethod).ToList() }; Points.Add(root); }