MessageModel
using System;
using System.Collections.Generic;
using System.Text;
namespace Pattern.Decorator
{
/**//// <summary>
/// Message實體類
/// </summary>
public class MessageModel
{
/**//// <summary>
/// 構造函數
/// </summary>
/// <param name="msg">Message內容</param>
/// <param name="pt">Message發布時間</param>
public MessageModel(string msg, DateTime pt)
{
this._message = msg;
this._publishTime = pt;
}
private string _message;
/**//// <summary>
/// Message內容
/// </summary>
public string Message
{
get { return _message; }
set { _message = value; }
}
private DateTime _publishTime;
/**//// <summary>
/// Message發布時間
/// </summary>
public DateTime PublishTime
{
get { return _publishTime; }
set { _publishTime = value; }
}
}
}
AbstractMessage
using System;
using System.Collections.Generic;
using System.Text;
namespace Pattern.Decorator
{
/**//// <summary>
/// 操作Message的抽象構件(Component)
/// </summary>
public abstract class AbstractMessage
{
/**//// <summary>
/// 獲取Message
/// </summary>
/// <returns></returns>
public abstract List<MessageModel> Get();
/**//// <summary>
/// 插入Message
/// </summary>
/// <param name="mm">Message實體對象</param>
/// <returns></returns>
public abstract bool Insert(MessageModel mm);
}
}