Patterns and Practices. Service layer?
Should I be doing my automapping in my service layer or at my controller?
I like the Idea of Repository - Raw data IQueryable type stuff with full domain(type) objects. Service layer - Paged, Ordered, Filtered, Automapped View model to return Controller - Push the view with the correct model
But having seen some nice stuff with ActionFilter开发者_Go百科s and attributes I'm wondering if a better approach would be
Repository - Raw data IQueryable type stuff with full domain(type) objects. Service layer - filtered, paged data Domain objects Controller - Automapping the service layer data and pushing the view.
Any thoughts on this would be greatly appreciated
You may have seen this article: http://www.lostechies.com/blogs/jimmy_bogard/archive/2009/06/29/how-we-do-mvc-view-models.aspx
I found this interesting and I plan to use it in my next project. It appears that you can still keep your controller thin and decorate your action methods with an automapper.
It sounds like this is what you're planning to do and it sounds like a good approach.
精彩评论