在MVP的模式 - 活动 [英] The Model in MVP - Events

查看:119
本文介绍了在MVP的模式 - 活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个分层的体系结构如下:

I have a layered architecture as follows;

presentation

服务

商务

数据

Presentation
Service
Business
Data

如果我实现最有价值球员为presentation我的理解是,服务层重新presents的M,即模型,是我的理解是否正确?如果从这样的MVP我间pretation模型可以提高这我presenters将订阅事件。这是否意味着我的服务层将引发事件?

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?

更新时间:

此问题已被浏览了许多次,但一直没有引起任何意见或答案,如果有什么不对的问题,请发表评论,因为我想获得这个答案。谢谢你。

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.

推荐答案

一个MVP设计的角度presenter部分背后的基本想法是,认为是轻量级的。多,人们投入的形式和控制逻辑驻留在presenter。在presenter是设计的大中央车站。检索数据,更新模型,和引发事件,让应用程序的其他领域知道的东西已经改变。该模型是主要集中于期望的数据的存储和检索。

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.

在使用MVP设计的关键问题是,如果我撕开形式X和使用表单ÿ取代它会发生什么?如果你发现自己做的presenter根本性的改变,以反映新的用户界面则有可能不是一个干净的MVP设计。

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.

这篇关于在MVP的模式 - 活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆