WPF/MVVM - should we create a different Class for each ViewModel ?

Posted by FMFF on Stack Overflow See other posts from Stack Overflow or by FMFF
Published on 2010-06-11T21:17:43Z Indexed on 2010/06/11 21:22 UTC
Read the original article Hit count: 335

Filed under:
|
|
|

I'm attempting the example from the excellent "How Do I" video for MVVM by Todd Miranda found in MSDN.

I'm trying to adapt the example for my learning purpose.

  1. In the example, he has a ViewModel called EmployeeListViewModel. Now if I want to include Departments, should I create another ViewModel such as DepartmentListViewModel?

  2. The example has EmployeeRepository as the Data Source. In my case, I'm trying to use an Entity object as the datasource (Employees.edmx in Model folder and EmployeeRepository.cs in DataAccess folder). If I want to display the list of Departments, should I create a separate class called DepartmentRepository and put all department related method definitions there?

  3. What if I want to retrieve the employee name and their department's name together? Where should I place the methods for this?

I'm very new to WPF and MVVM and please let me know if any of the above needs to be re-phrased.

Thank you for all the help.

© Stack Overflow or respective owner

Related posts about wpf

Related posts about architecture