Method 'GetEnumerator' in type Proxy<IEnumerable> does not have implementation

The solution was not to use IEnumerable when creating maps, only when using the map.

So, in the configuration I changed from

cfg.CreateMap<IEnumerable<PersistenceModels.MyClass>, IEnumerable<MyClass>>();

to

cfg.CreateMap<PersistenceModels.MyClass, MyClass>();

and everything worked.


I hit the same problem. I guess AutoMapper wants to be told which implementation of IEnumerable to use for the target, so the following worked for me.

cfg.CreateMap<IEnumerable<PersistenceModels.MyClass>, List<MyClass>>();
                                                      ^^^^

Tags:

Automapper