vendredi 23 décembre 2016

Design approach in MVVM

So i want to create a wpf form which shows the ressource planning for each week. The outcome should look like this:

enter image description here

I'm now struggling with the design of the viewmodel. Let's say I start like this (the child objects are indented):

WeekCollection
    Week // (from model)
        ProjectCollection
            Project // (from model)
                DayCollection
                    Day // (from model)
                        EmployeeCollection 
                            Employee // (from model)

Where I'm now struggling is, that with this approach, the classes in the model would be expanded to hold information, that is only needed for this particular viewmodel of the weekly planning. I.e. the class for day should have a date property, but not hold a collection for employees.

On the other hand, if I create a seperate viewmodel or a derrived collection class for each collection, wouldn't I get thousands of classes for the whole application?

So the question is, what is the best/usual way, to model the classes in an mvvm application, if the structure is like this?

Aucun commentaire:

Enregistrer un commentaire