Reputation: 31
As you may have seen the question from the title, i'm little bit confused about where to put the ViewModel classes in our web project. What is the best practice to putting ViewModel classes? Seperate assembly or in UI project?
We're working on a project that is built upon Asp.net MVC2 with DDD approach.
Thank you.
Upvotes: 3
Views: 2058
Reputation: 4181
As the name suggests ViewModel is the Model for the View and I consider them property of the Presentation Layer
I'd like to keep it in the Model folder in the MVC project.
For example a PersonDetail view can have a PersonModel and a PersonController. I keep the PersonModel in the MVC project and I return it from the PersonController to the view.
In practice I have a lot of ViewModel in the UI project, at least one for each view and they act like DTOs.
Upvotes: 2
Reputation: 71228
you can put them in your presentation layer (WebUI for me in asp.net mvc) or in your infrastructure project, or you can create a Dto project and put them in there
Upvotes: 0