MessageModel
using System;
using System.Collections.Generic;
using System.Text;
namespace Pattern.Bridge
{
/**//// <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; }
}
}
}
Message
using System;
using System.Collections.Generic;
using System.Text;
namespace Pattern.Bridge
{
/**//// <summary>
/// 操作Message(Abstraction)
/// </summary>
public class Message
{
private AbstractMessage _abstractMessage;
/**//// <summary>
/// 操作Message(Implementor)
/// </summary>
public AbstractMessage AbstractMessage
{
get { return _abstractMessage; }
set { _abstractMessage = value; }
}
/**//// <summary>
/// 獲取Message
/// </summary>
/// <returns></returns>
public virtual List<MessageModel> Get()
{
return _abstractMessage.Get();
}
/**//// <summary>
/// 插入Message
/// </summary>
/// <param name="mm">Message實體對象</param>
/// <returns></returns>
public virtual bool Insert(MessageModel mm)
{
return _abstractMessage.Insert(mm);
}
}
}