且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ASP.NET Web 窗体 - 模型视图展示器和用户控件

更新时间:2023-12-06 10:49:46

我的做法是为每个用户控件设置一个presenter,只负责用户控件的呈现,每页一个presenter (.aspx).我认为将事物分开也有助于维护,因为您将拥有瘦"的演示者,它只负责 UI 的一小部分.用户控件也将是自包含"的,您可以重用它们,因为呈现逻辑与页面呈现逻辑保持分离.

What I use to do is to have one presenter for each user control which is responsible only for the user control presentation and one presenter for each page (.aspx). I think keeping things separated helps also for maintaining as you will have "skinny" presenter which are responsible only of a small section of the UI. The user control will be also "self-contained" in the way that you can reuse them as the presentation logic is kept separated from the page presentation logic.

看看下面的帖子:

MVP 和 UserControls 和调用