AbstractMessageModel
using System;
using System.Collections.Generic;
using System.Text;
namespace Pattern.AbstractFactory
{
/**//// <summary>
/// 抽象Message實體類(AbstractProduct)
/// </summary>
public abstract class AbstractMessageModel
{
/**//// <summary>
/// 構造函數
/// </summary>
public AbstractMessageModel()
{
}
/**//// <summary>
/// 構造函數
/// </summary>
/// <param name="msg">Message內容</param>
/// <param name="pt">Message發布時間</param>
public AbstractMessageModel(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; }
}
/**//// <summary>
/// UserId
/// </summary>
public abstract string UserId
{
get;
set;
}
}
}
SqlMessageModel
using System;
using System.Collections.Generic;
using System.Text;
namespace Pattern.AbstractFactory
{
/**//// <summary>
/// SqlMessage實體類(Product)
/// </summary>
public class SqlMessageModel : AbstractMessageModel
{
/**//// <summary>
/// 構造函數
/// </summary>
public SqlMessageModel()
: base()
{
}
/**//// <summary>
/// 構造函數
/// </summary>
/// <param name="userId">UserId</param>
/// <param name="msg">Message內容</param>
/// <param name="pt">Message發布時間</param>
public SqlMessageModel(string userId, string msg, DateTime pt)
: base(msg, pt)
{
this._userId = userId;
}
private string _userId;
/**//// <summary>
/// Message內容
/// </summary>
public override string UserId
{
get { return _userId; }
set { _userId = value; }
}
}
}