0

The following exception thrown during mapping collection of DTOs to the collection of Models: A first chance exception of type 'System.TypeLoadException' occurred in mscorlib.dll Additional information: Method 'GetEnumerator' in type IEnumerable is not implemented. The structure is as follows:

  class UnauthorizedItemsDto { InspectableItemDto[] PeerToPeerApplications { get; set; } } public interface IUnauthorizedItems { IEnumerable<IInspectableItem> PeerToPeerApplications { get; } }
class UnauthorizedItems : IUnauthorizedItems
{

private RangeObservableCollection<IInspectableItem> _peerToPeerApplications;
        private RangeObservableCollection<IInspectableItem> PeerToPeerApplicationsImpl
        {
            get
            {
                return _peerToPeerApplications ??
                       (_peerToPeerApplications = new RangeObservableCollection<IInspectableItem>());
            }
        }
        public IEnumerable<IInspectableItem> PeerToPeerApplications
        {
            get { return PeerToPeerApplicationsImpl; }
        }
}

All relevant mappings for single items are added inside the mapping profile

Gena Verdel
  • 588
  • 5
  • 21
  • This [SO](http://stackoverflow.com/questions/8760322/troubles-implementing-ienumerablet) may have some input for you. Just check it. – Siva Gopal Aug 27 '15 at 08:48
  • Thanks, but that's not the case. I'm not providing my own implementation of IEnumerable but rather using BCL types or derivations of thereof. I don't understand whether AutoMapper requires that the collections in the target object are concrete types instead of interfaces. – Gena Verdel Aug 27 '15 at 08:58

0 Answers0