I was learning AutoMapper and understand its use for object to object mapping. But now EFCodeFirst,dapper and Petpoco all cools stuff are there which will allow us to use our POCO directly with database?
So can anybody let me know why we still need automapper?
Thanks in advance
Best Regards,
Jalpesh
I usually use Automapper to map Domain models to view mdoels. If doing DDD it is often suggested that it’s not a great idea to use your Domain models in you views – views often have a different set of concerns to the domain.
For example, you may have a User model in your domain:
And you may have a User summary page which shows a subset of these items:
You could use the UserSummary class on the view, but you would probably fetch the domain user model from the db. In this case you could use Automapper to map the Domain.User to the ViewModel.UserSummary