protected IEnumerable <IEdmDirectValueAnnotation> ComputeDirectValueAnnotations() { if (this.Element == null) { return(null); } List <CsdlDirectValueAnnotation> annotations = this.Element.ImmediateValueAnnotations.ToList(); CsdlElementWithDocumentation elementWithDocumentation = this.Element as CsdlElementWithDocumentation; CsdlDocumentation documentation = (elementWithDocumentation != null) ? elementWithDocumentation.Documentation : null; if (documentation != null || annotations.FirstOrDefault() != null) { List <IEdmDirectValueAnnotation> wrappedAnnotations = new List <IEdmDirectValueAnnotation>(); foreach (CsdlDirectValueAnnotation annotation in annotations) { wrappedAnnotations.Add(new CsdlSemanticsDirectValueAnnotation(annotation, this.Model)); } if (documentation != null) { wrappedAnnotations.Add(new CsdlSemanticsDocumentation(documentation, this.Model)); } return(wrappedAnnotations); } return(null); }
protected IEnumerable <IEdmDirectValueAnnotation> ComputeDirectValueAnnotations() { CsdlDocumentation documentation; if (this.Element != null) { List <CsdlDirectValueAnnotation> list = this.Element.ImmediateValueAnnotations.ToList <CsdlDirectValueAnnotation>(); CsdlElementWithDocumentation element = this.Element as CsdlElementWithDocumentation; if (element != null) { documentation = element.Documentation; } else { documentation = null; } CsdlDocumentation csdlDocumentation = documentation; if (csdlDocumentation != null || list.FirstOrDefault <CsdlDirectValueAnnotation>() != null) { List <IEdmDirectValueAnnotation> edmDirectValueAnnotations = new List <IEdmDirectValueAnnotation>(); foreach (CsdlDirectValueAnnotation csdlDirectValueAnnotation in list) { edmDirectValueAnnotations.Add(new CsdlSemanticsDirectValueAnnotation(csdlDirectValueAnnotation, this.Model)); } if (csdlDocumentation != null) { edmDirectValueAnnotations.Add(new CsdlSemanticsDocumentation(csdlDocumentation, this.Model)); } return(edmDirectValueAnnotations); } else { return(null); } } else { return(null); } }