MVVM where to put Data Access Layer?

后端 未结 6 1405
自闭症患者
自闭症患者 2020-12-07 16:13

I am investigating WPF\'s MVVM design pattern. But am unsure where to put the Data Acess code?

In some examples I have looked at, data access is performed directly i

6条回答
  •  死守一世寂寞
    2020-12-07 16:22

    I would add another layer, essentially what you want is a data factory. You want to create a set of classes that will CRUD to the database for you and return clean POCO objects to the ViewModel.

    A good example to look at would the Nerd Dinner book. It covers MVC not MVVM but the patterns are very similar and the way they access data in that solution would be good starting point.

    Hope this helps.

提交回复
热议问题