Having POCOs, Entities and ViewModels in a solution feels like overkill

Having POCOs, Entities and ViewModels in a solution feels like overkill

The latest version of the Entity Framework got me in love, still at good as it is I don't like using entities objects as domain objects for all the obvious headaches, so what I'm doing is translating retrieved entity objects in my services and returning POCOs to whomever consumes the service. Thanks to automapper the translation from pocos to entities and back results in some easily maintainable code inside the services. Where things get hairy is when you add ViewModels to the picture and you end up mapping a viewmodel to the poco in the controller and then mapping the poco to the entity object in the service to be stored in the repository.

Would you consider this an overkill or am I being too nitpicking ?

C# ASP.NET MVC User Control


Is there a way for MVC Partial View retrieved using jQuery to keep UI CSS Styling?
It's not 'overkill' although 'overhead'. Check Checkbox based on value in CSVAnd It is inevitable when you want proper layering. linq to sql joining two tableThe ViewModels belong to the UI layer, you don't want to mix this with the POCOs.. Inserting markup into hidden jqGrid column And while you might call it 'overkill' for a small app, which boundary would you rather sacrifice? . MVC make action link perform a submit
asp.net mvc int property bind exceptionHow do I pass a list of integers to an MVC action?


Entity Framejob 4 has built-in support for POCO's. A good place to start on this is http://blogs.msdn.com/b/adonet/archive/2009/05/21/poco-in-the-entity-framework-part-1-the-experience.aspx. In short, you must have your domain model project this is completely persistence ignorant. You must use this approach with the newly introduced Code First approach in EF 4. Now you don't need Automapper anymore for your POCO's to Entity Objects conversion and vice versa. You can, however, use Automapper to map between POCO's and ViewModels reducing a lot of the plumbing code.. HTH..

51 out of 100 based on 31 user ratings 231 reviews