Note that there are some explanatory texts on larger screens.

plurals
  1. POMVVM Roles for each layer
    primarykey
    data
    text
    <p>First of all I'm ashamed of myself for not being able to grasp the essence of MVVM patern after such a long struggle, and I can't help but to ask.</p> <p>I searched and searched about MVVM but the layers that has been (seems to) clear to me is only the View and ViewModel layer.</p> <p>So here is what I have been grasping until now with some little example, FYI I'm using MySQL queries to fetch my data :</p> <p><strong>Model</strong></p> <p>It's unclear to me what to do here. I have this class of Employee.cs : </p> <pre><code>class Employee { public string Id { get; set; } public string Name { get; set; } public string Gender { get; set; } } </code></pre> <p>My question : Should I do the queries to fetch data from MySQL database in EmployeeModel class? I read about this <a href="https://stackoverflow.com/a/5454674/1414520">answer</a> that Data Access layer is a different thing than MVVM's Model, plus I can use a repository to request a list of Employees from my Data Access layer.</p> <p>Based on that answer then it should be like :</p> <ul> <li>Employee.cs [Object properties definition], </li> <li>EmployeeDataAccess.cs [Responsible to fetching Employee(s) data from MySQL]</li> <li>EmployeeRepository.cs [Called by EmployeeModel to get Employee data from DA]</li> <li>EmployeeModel.cs [Where I handle business logic like validation etc and use INotifyPropertyChanged on pretty much same properties as Employee.cs]</li> <li>EmployeeViewModel.cs [EmployeeView's data context]</li> <li>EmployeeView.cs [XAML]</li> </ul> <p>All of that for one page of Employee list, am I doing something wrong?</p> <p>Sorry for the long question, if I said something wrong I would be more than glad to fix it.</p> <p>I'm really clueless at the moment, so any fresh perspective is greatly appreciated.</p> <p>Cheers !</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload