开发者

Where to put "ViewModel Classes" in DDD approach?

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 开发者_StackOverflow中文版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.


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜