MattHoneycutt / HeroicFramework

The Heroic Framework contains utilities and application framework infrastructure to streamline .NET application development.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing type map configuration or unsupported mapping error when multiple projects reference Heroic.AutoMapper.

jbarrineau06 opened this issue · comments

commented

Hello,

I'm having an issue with Heroic.Automapper. When I start my MVC 5 app, it runs the Configure method in AutoMapperConfig.cs, and if I pause and run AutoMapper.Mapper.Configuration.GetAllTypeMaps() it shows that all maps have been defined correctly.

However, the first time I hit a controller action, if I pause before doing anything and run GetAllTypeMaps() again, it shows that I only have one mapping defined, and it's in my Data project. I have tried all the different HeroicAutoMapperConfigurator loading methods to no avail.

UPDATE
So I fixed the issue but I'm a little confused as to why what I did fixed it. Instead of using WebActivator, I commented that line out and manually called the Configure() method in global.asax and everything works now.

UPDATE 2
Ok, I figured out what happened and I feel silly. I installed the nuget package to 3 projects, so the web project was creating the maps correctly, but when the data project was accessed it called it's own Configure() method and overwrote the maps. It now works since I have removed the nuget package from all projects except the web project. Sorry to clutter your issues with a pointless one.

Hi @jbarrineau06, that's good to know! I'm going to reopen this as a bug: you should definitely be able to install Heroic.AutoMapper to multiple projects without them clobbering each other. I'll come up with a solution for that.