CheckInputWrapper
using System;
using System.Collections.Generic;
using System.Text;
namespace Pattern.Decorator
{
/**//// <summary>
/// 擴展出輸入驗證的功能(ConcreteDecorator)
/// </summary>
public class CheckInputWrapper : AbstractMessageWrapper
{
/**//// <summary>
/// 構造函數
/// </summary>
/// <param name="abstractMessage">AbstractMessage</param>
public CheckInputWrapper(AbstractMessage abstractMessage)
: base(abstractMessage)
{
}
/**//// <summary>
/// 獲取Message
/// </summary>
/// <returns></returns>
public override List<MessageModel> Get()
{
List<MessageModel> l = base.Get();
foreach (MessageModel mm in l)
{
mm.Message += "(經過輸入驗證)";
}
return l;
}
/**//// <summary>
/// 插入Message
/// </summary>
/// <param name="mm">Message實體對象</param>
/// <returns></returns>
public override bool Insert(MessageModel mm)
{
// 在這裡擴展功能
return base.Insert(mm);
}
}
}