IMessage
using System;
using System.Collections.Generic;
using System.Text;
namespace Pattern.Proxy
{
/**//// <summary>
/// 對Message操作的接口
/// </summary>
public interface IMessage
{
/**//// <summary>
/// 獲取Message
/// </summary>
/// <returns></returns>
List<MessageModel> Get();
/**//// <summary>
/// 插入Message
/// </summary>
/// <param name="mm">Message實體對象</param>
/// <returns></returns>
bool Insert(MessageModel mm);
}
}
SqlMessage
using System;
using System.Collections.Generic;
using System.Text;
namespace Pattern.Proxy
{
/**//// <summary>
/// Sql方式操作Message
/// </summary>
public class SqlMessage : IMessage
{
/**//// <summary>
/// 獲取Message
/// </summary>
/// <returns></returns>
public List<MessageModel> Get()
{
List<MessageModel> l = new List<MessageModel>();
l.Add(new MessageModel("SQL方式獲取Message", DateTime.Now));
return l;
}
/**//// <summary>
/// 插入Message
/// </summary>
/// <param name="mm">Message實體對象</param>
/// <returns></returns>
public bool Insert(MessageModel mm)
{
// 代碼略
return true;
}
}
}