I have a WPF MVVM and ASP MVC applications that show information about students and teachers. WPF app gets and saves information about students and teachers from the web service and display it in the list. Both students and teachers has first name, last name and age. Each student has also GPA (grade point average). Each teacher has also photo. The same list of students and teachers needs to be displayed in ASP MVC app.
So in my implementation I have AbstractPersonDto, StudentDto and TeacherDto. I have the service:
interface IService
{
IList<AbstractPersonDto> GetAllPersons();
void SaveAllPersons(IList<AbstractPersonDto> persons);
}
I have also view models: AbstractPersonViewModel, StudentViewModel, TeacherViewModel in WPF and 3 more in ASP app.
The first question is: Does mapping from IList<AbstractPersonDto> to IList<AbstractPersonViewModel> violates Open-Closed and Liskov principles?
In my views in WPF and ASP MVC I use DataTemplate and DisplayFor to select appropriate template and partial view respectively.
So the second question is: Using this templates selectors also violates Open-Closed and Liskov principles or not?
Aucun commentaire:
Enregistrer un commentaire