Should I use DTOs as my data models in MVVM?

前端 未结 3 1716
死守一世寂寞
死守一世寂寞 2021-02-04 12:34

I\'m currently working on what will be my first real foray into using MVVM and have been reading various articles on how best to implement it.

My current thoughts are to

3条回答
  •  甜味超标
    2021-02-04 13:02

    I'm no expert on this. I had just the same scenario. I agree with you that that is quite an overkill. I've been using this solution for quite some time now and haven't encountered any issues. The INotifyPropertyChanged isn't a big problem for me since nothing on the server-side will subscribe to the PropertyChanged event. If you will use inheritance on your data models, then all must be serializable. In my scenario, I have two base classes for my data models: one that is used for data transfer, and the other not.

提交回复
热议问题