I'm having quite a bit of trouble trying to understand this pattern. At work we are implementing MVP with passive views. We are using WinForms.
- So we have a View (which is a windows form), which implements an interface and has a presenter.
- The presenter gets an instance of the interface which the view implements, and manages the view throw the interface.
- The presenter can see the model, and a manager.
- The manager handles the database persistance of several models, but it does not add them manually, it uses a separate layer, called Data, so it tells that layer to persist data
- The data layer then persists the data to the database, using Entity Framework
Say we have a view of Clients, which reperesents a Model Clients and we have a table in our database called Clients. Clients can have name, and city.
We also have a view for Cities, which is a simple add, edit and remove, it also represents a model City, and a table City.
Now in our view of Clients, we want to let the user add a new city, so in the view, we open another view, the Cities view, the user then creates a new city.
From the Clients view, I want to see what City the user added, how is that possible? Shall the view return something?
(I want to have it in memory, not persist anything to the database when adding a city, I just want the model of the city)
I think returning a model and viewing models from the view is not MVP. How can I do it then?