介绍
将一个请求封装为一个对象,从而使你可用不同的请求对客户进行参数化;对请求排队或记录请求日志,以及支持可取消的操作。


示例
有一个Message实体类,某个类对它的操作有Insert()和Delete()方法。现在要求可以对之前的所有操作做撤销和重复。
设计模式 - Command Pattern(命令模式)


MessageModel
设计模式 - Command Pattern(命令模式)using System;
设计模式 - Command Pattern(命令模式)
using System.Collections.Generic;
设计模式 - Command Pattern(命令模式)
using System.Text;
设计模式 - Command Pattern(命令模式)
设计模式 - Command Pattern(命令模式)
namespace Pattern.Command
}

Action
设计模式 - Command Pattern(命令模式)using System;
设计模式 - Command Pattern(命令模式)
using System.Collections.Generic;
设计模式 - Command Pattern(命令模式)
using System.Text;
设计模式 - Command Pattern(命令模式)
设计模式 - Command Pattern(命令模式)
namespace Pattern.Command

SqlMessage
设计模式 - Command Pattern(命令模式)using System;
设计模式 - Command Pattern(命令模式)
using System.Collections.Generic;
设计模式 - Command Pattern(命令模式)
using System.Text;
设计模式 - Command Pattern(命令模式)
设计模式 - Command Pattern(命令模式)
namespace Pattern.Command

ICommand
设计模式 - Command Pattern(命令模式)using System;
设计模式 - Command Pattern(命令模式)
using System.Collections.Generic;
设计模式 - Command Pattern(命令模式)
using System.Text;
设计模式 - Command Pattern(命令模式)
设计模式 - Command Pattern(命令模式)
namespace Pattern.Command

SqlMessageCommand
设计模式 - Command Pattern(命令模式)using System;
设计模式 - Command Pattern(命令模式)
using System.Collections.Generic;
设计模式 - Command Pattern(命令模式)
using System.Text;
设计模式 - Command Pattern(命令模式)
设计模式 - Command Pattern(命令模式)
namespace Pattern.Command

Message
设计模式 - Command Pattern(命令模式)using System;
设计模式 - Command Pattern(命令模式)
using System.Collections.Generic;
设计模式 - Command Pattern(命令模式)
using System.Text;
设计模式 - Command Pattern(命令模式)
设计模式 - Command Pattern(命令模式)
namespace Pattern.Command


client
设计模式 - Command Pattern(命令模式)using System;
设计模式 - Command Pattern(命令模式)
using System.Data;
设计模式 - Command Pattern(命令模式)
using System.Configuration;
设计模式 - Command Pattern(命令模式)
using System.Collections;
设计模式 - Command Pattern(命令模式)
using System.Web;
设计模式 - Command Pattern(命令模式)
using System.Web.Security;
设计模式 - Command Pattern(命令模式)
using System.Web.UI;
设计模式 - Command Pattern(命令模式)
using System.Web.UI.WebControls;
设计模式 - Command Pattern(命令模式)
using System.Web.UI.WebControls.WebParts;
设计模式 - Command Pattern(命令模式)
using System.Web.UI.HtmlControls;
设计模式 - Command Pattern(命令模式)
设计模式 - Command Pattern(命令模式)
using Pattern.Command;
设计模式 - Command Pattern(命令模式)
设计模式 - Command Pattern(命令模式)
public partial class Command : System.Web.UI.Page

相关文章: