Web Api: custom binding with AutoMapper

In Web Api 2.0 and MVC5 you can only pass: int, bool, double etc.., TimeSpan, DateTime, Guid, decimal, and string values in URI. For any complex type having lists or other complex object within you have to pass serialized JSON/XML in the request body. But what If we want use such complex type from URI? Then read on… What is binding? Binding is a mechanism used by the Web Api to…

By Piotr on (tags: automapper, mvc, Web API, categories: code)

Object-object mapping

I recently stumbled upon automapper. It’s a handy little library used for object-object mapping. Let’s take a look at that. The simplest usage If you find yourself having classes such as Foo, FooViewModel, FooListViewModel, FooDTO you probably have a decent amount of code which looks more or less like this: If you’re lazy like me, you probably wrapped that in some extension met…

By on (tags: automapper, categories: code)