I have the following code which is not working:
var groupedZones = this._zoneDataManager.GetZonesGroupedByCountry();
            IEnumerable<IGrouping<String, ZoneDTO>> zonesToReturn = Mapper.Map<IEnumerable<IGrouping<String, Zone>>, IEnumerable<IGrouping<String, ZoneDTO>>>(groupedZones);
I keep getting the following exception:
The value \"System.Collections.Generic.List
1[SCGRE.Business.Model.ZoneDTO]\" is not of type \"System.Linq.IGrouping2[System.String,SCGRE.Business.Model.ZoneDTO]\" and cannot be used in this generic collection.\r\nParameter name: value
I do not understand why it is trying to map a List<T> into an IGrouping<String, T> or maybe I did not understand the exception properly... But I basically have an IEnumerable<IGrouping<String, Zone>> and I want to map it to IEnumerable<IGrouping<String, ZoneDTO>>
Note that I have created a map from Zone to ZoneDTO as follows:
Mapper.CreateMap<Zone, ZoneDTO>();
And that's because both classes have almost exactly the same properties.
Any ideas?