MVP - 多少主持人 [英] MVP - How many presenters

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

问题描述

通常的做法是一个View视图的主持人,另一个用于编辑视图,或者应该在一个演示者中。

解决方案

我遵循的经验法则是...
- 1演示者1视图



但是,对于常用控件,如果演示文稿逻辑是一样的...
例如...
你有一个对话框控件为确认对话框,操作完成对话框!和许多其他变体...
为此我从一个共同的视图界面实现了这个控制,并有一个演示者服务于整套对话控件...



原因是它有助于保持模式的清洁。另外,在灵活性方面,这有其自身的优势。最近我有一个任务,将一个基于MVP的Windows应用程序迁移到asp.net(1视图1主持人)经验法则)。迁移是无缝的,因为我只需要担心创建各自的意见,其余的东西被设计照顾。


What is common practice, one presenter for View view and one for Edit view, or should it be all in one presenter.

解决方案

The rule of thumb which I follow is... - 1 Presenter 1 View

But for common controls you could share the presenter if the presentation logic is same... For eg... You have a Dialog control for "Confirmation dialog", "Operation Complete dialog!", and many other variants... For this I had this control realize from a common view interface and had one presenter serving the whole suite of dialog controls...

The reason is it helps to keep the pattern clean. Also, in terms of flexibility this has its own benefit..

Recently I had a task to migrate a windows application built on MVP to asp.net (1 view 1 presenter rule of thumb). The migration was seamless as I only had to worry about creating respective views rest of the things were taken care of by the design.

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

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