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 ?

ASP.NET MVC forces an AJAX request be redirected to the login page when the FormsLogin session is no longer active


How to make a default editor template for enums?
It's not 'overkill' although 'overhead'. Asp.net MVC Visible/hideAnd It is inevitable when you want proper layering. AppFabric vs Unity vs Memcached or possibly any other multi server caching mechanisms [closed]The ViewModels belong to the UI layer, you don't want to mix this with the POCOs.. ASP.NET MVC/LINQ - retreiving tables and number of connections And while you might call it 'overkill' for a small app, which boundary would you rather sacrifice? . Is it better to return the most specific or most general type from an action method?
How to make these 2 blocks of almost identical code reusable?Using ASP.NET MVC 2, StructureMap, Fluent NHibernate, and PostgreSQL


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..

91 out of 100 based on 66 user ratings 701 reviews