SqlMessage
using System;
using System.Collections.Generic;
using System.Text;
namespace Pattern.Observer
{
/**//// <summary>
/// Sql方式操作Message(ConcreteObserver)
/// </summary>
public class SqlMessage : IMessage
{
/**//// <summary>
/// 插入Message
/// </summary>
/// <param name="mm">Message實體對象</param>
/// <returns></returns>
public string Insert(MessageModel mm)
{
return "sql方式:" + mm.Message + " " + mm.PublishTime.ToString();
}
}
}
XMLMessage
using System;
using System.Collections.Generic;
using System.Text;
namespace Pattern.Observer
{
/**//// <summary>
/// XML方式操作Message(ConcreteObserver)
/// </summary>
public class XMLMessage : IMessage
{
/**//// <summary>
/// 插入Message
/// </summary>
/// <param name="mm">Message實體對象</param>
/// <returns></returns>
public string Insert(MessageModel mm)
{
return "XML方式:" + mm.Message + " " + mm.PublishTime.ToString();
}
}
}