Your Ad Here
首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 编程语言 > .NET > VB.NET > PM Pattern Rework
【标  题】:PM Pattern Rework
【关键字】:PM,Pattern,Rework
【来  源】:http://yysun.cnblogs.com/archive/2006/06/08/420173.html

PM Pattern Rework

Your Ad Here

In my previous post, I tried to implement the Presentation Model (PM) using CAB, which is an alternate way besides MVP to improve the MVC pattern.

Since I liked the idea that WorkItem is the container of use case, here I show the use cases again.
Customer Use Case
Therefore I must have 4 WorkItem sub classes. These classes contain Views. The views share one PM and pull data from it.

Last time, the biggest trouble I had is how to pass the PM instance, because I tried to use the [Dependency] attribute to inject the object and tried to store it in WorkItem's State. Both are bad ideas. The [Dependency] attribute is mainly for ObjectBuilder internal use. And inject into WorkItem's State just dose not work.

 

Now I realized that the PM actually can be treated as a serviceUsing the [Service] attribute and the [ServiceDependency] attribute, the structure started looking really better now.

1. Define the PM as service
[Service]
public class CustomerPMController: ICustomerDetailView, ICustomerListView
{
}

2. Access PM as service dependency
public partial class CustomerListView : TitledSmartPart
{
   
private ICustomerListView controller = null;
   
[ServiceDependency(Required = true, Type = typeof(CustomerPMController))]
   
public ICustomerListView Controller
    {
       
set { controller = value; }
    }
    ....
}

That's it. Everything is declarative and objects are built by OB through attribute.

A very small thing not 100% statisfied is that I have to use
[ServiceDependency(Required = true, Type = typeof(CustomerPMController))]
instead of
[ServiceDependency(Required = true, Type = typeof(ICustomerListView))]

A service can only register for one type?

让 NDoc 1.3 支持.NET 2.0 程序集,泛型输出和 Visual studio 2005 解决方案导入:【上一篇】
Asp.net服务器控件编程(3) ViewState(一)——asp.net控件的精华之一:【下一篇】
【相关文章】
  • JBPM's DB
  • UML2 Utilities for Model Driven Development
  • The Provider Design Pattern and Data Access Component - III
  • phpMyAdmin安装与配置
  • 修改Phpmyadmin认证方式
  • 如何解决FedoraCore的RPM包安装过程中的依赖性关系
  • 装饰模式(Decorator pattern)应用----日志信息输出
  • PHPMVC2
  • RPM制作教程(一)
  • RPM制作教程(二)
  • 【随机文章】
  • 内核参数修改步骤
  • MATLAB 多项式拟合和非线性最小二乘
  • linux kernel 2.4.5 ipv4 socket层的一点解释
  • 使用VB.NET实现 Google Web Service
  • Linux下怎么挂接u盘
  • 终于可以在CentOS里面用QQ了
  • C#的参数传递
  • Linux下hp LaserJet8100网络打印机的配置
  • ASP.net中怎么在两个页面之间传递数据
  • Oracle补丁下载网站!
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 软讯网络 All Rigths Reserved.