开发者

ASP MVC/EF 4 Design - to use a viewmodel or not?

开发者 https://www.devze.com 2023-03-20 02:02 出处:网络
I have a list of somewh开发者_开发技巧at complex entity graphs representing video game reviews.I\'m going to create separate navigation based on the graphs\' properties - game title, platform name(s),

I have a list of somewh开发者_开发技巧at complex entity graphs representing video game reviews. I'm going to create separate navigation based on the graphs' properties - game title, platform name(s), genre. At the end, it will be Wiki-like.

What I'm wondering is this - should I do the work to grab this navigation info in my controller and store it all in a view model, or should I simply pass my list of graphs into the view, and manipulate it there? Does it matter, in this case?


IT is good convention to use a ViewModel when passing information to the views. ViewModel suggests a link to a View. In a perfect world then we would use 1 ViewModel per View

there is a great article by Jimmy Bogard (author of MVC 3 in Action) that could help here

0

精彩评论

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

关注公众号