private static IdentifyFeature ReplaceAliasWithFieldName(IdentifyItem identifyItem, IReadOnlyList<FieldInfo> fields)
{
if (identifyItem == null || identifyItem.Feature == null || identifyItem.Feature.Attributes == null || fields == null || !fields.Any())
return new IdentifyFeature(identifyItem);
var identifyFeature = new IdentifyFeature(identifyItem);
var attr = identifyItem.Feature.Attributes;
foreach (var field in fields)
{
var key = attr.Keys.FirstOrDefault(k => k == field.Alias && k != field.Name);
if (string.IsNullOrEmpty(key)) continue;
attr[field.Name] = attr[key];
attr.Remove(key);
if (identifyItem.DisplayFieldName == key)
identifyFeature = new IdentifyFeature(new IdentifyItem(identifyItem.LayerID,
identifyItem.LayerName, field.Name, identifyItem.Value, identifyItem.Feature));
}
return identifyFeature;
}