Bestpractice - Mixing View Model with Domain Model

前端 未结 2 1736
灰色年华
灰色年华 2020-12-07 01:10

Is it reasonable to mix view models with domain models?

So i.e. the view model object contains some domain model objects (not the other way around!)

2条回答
  •  余生分开走
    2020-12-07 02:11

    I tend to create separate view models that contain just what I need to be displayed in the view. AutoMapper is a create tool for making this easier.

提交回复
热议问题