1
votes

I have successfully created a asp mvc app which basically has interface, service and dataacces - AKA the repository pattern..

What would be the best way to call my service (my repository pattern) from an MVVM structured WPF app..

From what i see.. in the MODEL in wpf i presume i call my service (repository pattern) from the model and then return data to my viewmodel for displaying on the view??

Should this model be thin i.e. has little code and just call the service.. and return data to the viewmodel for processing or should the MODEL call the repository service and do the processing in the model before retruning to the viewmodel??

I am a little confused how i can use my WORKING repository pattern in the realm of a new WPF MMVM app i am designing...

Any ideas?

Thanks

1

1 Answers

4
votes

I think you are complicating matters by focusing on the fact that your data access uses a repository pattern. It's irrelevant. You could be using Joe's Box' O' Data pattern and your underlying question would be the same. Let's forget you are using that pattern and focus on what you are doing: getting data from a data source.

When you get data from a data source, this is generally considered to be your Model. It's data, but it lacks certain behavioral things that make it appropriate for showing on the screen (lack of INotifyPropertyChanged implementation, for example). What people generally do with this is adapt their business objects into something that can be more readily used by a view (a view model).

You will use this technique regardless of the pattern in use for getting your data.