I have an MVC project where I use AutoMapper to map Entity Framework objects to view models. The code that defines the mappings is in the boostrapper class, which is called automatically when the application starts (App_Start, Global.asax)
I am refactoring my code to put all my business logic at the service level, because we need to implement a batch process that runs daily, which runs the same logic as the MVC application.
One of the problems I am facing now is that I need to map the objects of my database to some domain objects at my service level. I think that everything will work well in an MVC application, because bootstrapper is still being called in Global.asax.
Is there a way that my mapping code works for my MVC application as well as for another application other than MVC (maybe WCF service, console application, etc.). Where can I put this mapping code so that it is called by two applications only once?
source share