I’m on a “Combine These Two NuGet Packages in Web API” kick lately, so let’s keep that going! We’re going to set up an ASP.NET Web API project that uses AutoMapper and StructureMap to provide us with mapping and injection-based repositories and controllers. I already covered how to get started with StructureMap in Setting Up Dependency Injection in ASP.NET Web API, so this post will focus more on what AutoMapper does and how to use it in Dependency Injection (DI) scenarios. Let’s get started!

What is AutoMapper?
AutoMapper is a convention-based mapping library that maps values from one instance of an object to another. In most cases, the values will be mapped if the name and type of the properties match in both the source and destination objects. AutoMapper is also very flexible, allowing for you to design an entirely custom mapping rule set to support any scenario. In this post, we’ll mostly use AutoMapper’s default settings. For more information about one of my favorite NuGet packages ever, read the docs.

#asp.net web api #automapper

Using AutoMapper with StructureMap in ASP.NET Web API
19.30 GEEK