SqlMessage
using System;
using System.Collections.Generic;
using System.Text;
namespace Pattern.TemplateMethod
{
/**//// <summary>
/// Sql方式操作Message
/// </summary>
public class SqlMessage : AbstractMessageTemplate
{
/**//// <summary>
/// 構造函數
/// </summary>
/// <param name="userId">UserId</param>
public SqlMessage(string userId)
: base(userId)
{
}
/**//// <summary>
/// 獲取Message
/// </summary>
/// <returns></returns>
public override List<MessageModel> Get()
{
List<MessageModel> l = new List<MessageModel>();
l.Add(new MessageModel("SQL方式獲取Message", DateTime.Now));
return l;
}
}
}
XMLMessage
using System;
using System.Collections.Generic;
using System.Text;
namespace Pattern.TemplateMethod
{
/**//// <summary>
/// XML方式操作Message
/// </summary>
public class XMLMessage : AbstractMessageTemplate
{
/**//// <summary>
/// 構造函數
/// </summary>
/// <param name="userId">UserId</param>
public XMLMessage(string userId)
: base(userId)
{
}
/**//// <summary>
/// 獲取Message
/// </summary>
/// <returns></returns>
public override List<MessageModel> Get()
{
List<MessageModel> l = new List<MessageModel>();
l.Add(new MessageModel("XML方式獲取Message", DateTime.Now));
return l;
}
}
}