It's only a sample I have viewModels in many cases but the problem still there with the entity to viewModel. Why doesn't allow the work in a disconnected way to facilitate the mapping? In simple views why can't pass a detached entity? If is the same that the viewModel. This mode allow me write the tests of my service layer. Is not the same that a connection from db to ui with the business logic in the ui El 31/10/2011 14:12, "Ramon Smits" <[email protected]> escribió:
> I read in many sites that is better create another object to pass to >> another layers in place of the domain objects, but what is the advantage of >> this way to justify the extra work? I'm working in a dynamic language in >> the UI, I don't have strongly typed objects and my UI knows whats is >> loading in each view. Why i have to create for example 5 Book DTO different >> depending in the context that the UI layer is demanding, one book for show >> the product, another for the view of invoices.... >> > > This is usually what you do! You have a view model and your domain model > which you map somewhere. Having such a mapping makes maintenance and > testing a very nice thing to do! > > I really would not like to take your application in maintenance if you > just map your data from storage to user interface and back. If that is what > you want, then why not have direct database connections from your client > like in the client/server days. > > -- > Ramon > >
