问题
I have a layered architecture as follows;
Presentation
Service
Business
Data
If I implement MVP for the presentation my understanding is that the Service Layer represents the 'M' i.e. model, is my understanding correct? If so from my interpretation of MVP the model can raise events which my presenters would subscribe to. Does this mean that my service layer would raise events?
UPDATED
This question has been viewed a number of times but has not attracted any comments or answers, if there is something wrong with the question please comment as I would like to get an answer on this. Thanks.
回答1:
The basic idea behind the View Presenter portion of a MVP design is that view is lightweight. Much of the logic that folks put into the form and controls reside in the Presenter. The Presenter is the grand central station of the design. Retrieving the data, updating the model, and raising events to let the other areas of the application know that something has changed. The model is mostly focuses on the storage and retrieval of the desired data.
The key question in using MVP design is what happens if I rip off Forms X and replace it with Forms Y? If you find yourself making radical changes to the presenter to reflect the new UI then likely it not a clean MVP design.
来源:https://stackoverflow.com/questions/1996433/the-model-in-mvp-events