private IEnumerable <string> EnumerateEntityValues(Entity entity, FetchXmlAction fetcher) { //foreach (string key in entity.Attributes.Keys) foreach (KeyValuePair <string, AttributeMetadata> a in fetcher.Attributes) { if (!entity.Contains(a.Key)) { yield return(null); if (a.Value.AttributeType == AttributeTypeCode.Lookup) { yield return(null); } continue; } object value = entity[a.Key]; yield return(fetcher.FormatObject(value, a.Key)); if (a.Value.AttributeType == AttributeTypeCode.Lookup) { yield return(((EntityReference)value).Name); } } }