AutoMapper and EntityFramework Proxies – a workaround

This is a quick workaround for an issue I came across when working with AutoMapper on EF. Its one of those blog posts that’s as much a reminder for the writer as anything else.

I was trying to repopulate an entity instance from a corresponding model instance using a line similar to the following:

Mapper.Map<MyModel,MyEntity>(model, ent);

At this line I got an AutoMapper.AutoMapperMappingException accompanied by the following message:

Missing type map configuration or unsupported mapping. Mapping types: MyModel-> MyEntity_238F6DF9C0DAD0768B6BF2E9… MyProject.MyModel-> System.Data.Entity.DynamicProxies.MyEntity_238F6DF9C0DAD0768B6BF2E9…

Take as read that I certainly did have a Mapper.Create<MyModel,MyEntity>() type line in place.

Continue reading AutoMapper and EntityFramework Proxies – a workaround