ViewModels with asp.net mvc 4 and EntityFramework whats the Point

后端 未结 3 1708
北荒
北荒 2020-12-19 10:52

I\'m debating with myself whats the point in creating ViewModel classes in a project which uses Entity Framework?

I currently have a project which uses EntityFramewo

3条回答
  •  被撕碎了的回忆
    2020-12-19 11:13

    I would take a look at this question What is ViewModel in MVC which explains the purpose of the ViewModel.

    There is nothing wrong with passing the Model directly from your Entity into the View, but a ViewModel can be used when your Model is not an exact match for the data you need.

提交回复
热议问题