SqlMessageFactory
using System;
using System.Collections.Generic;
using System.Text;
namespace Pattern.AbstractFactory
{
/**//// <summary>
/// SqlMessage工廠(ConcreteFactory)
/// </summary>
public class SqlMessageFactory : AbstractMessageFactory
{
/**//// <summary>
/// 創建SqlMessageModel對象
/// </summary>
/// <returns></returns>
public override AbstractMessageModel CreateMessageModel()
{
return new SqlMessageModel();
}
/**//// <summary>
/// 創建SqlMessage對象
/// </summary>
/// <returns></returns>
public override AbstractMessage CreateMessage()
{
return new SqlMessage();
}
}
}
XMLMessageFactory
using System;
using System.Collections.Generic;
using System.Text;
namespace Pattern.AbstractFactory
{
/**//// <summary>
/// XMLMessage工廠(ConcreteFactory)
/// </summary>
public class XMLMessageFactory : AbstractMessageFactory
{
/**//// <summary>
/// 創建XMLMessageModel對象
/// </summary>
/// <returns></returns>
public override AbstractMessageModel CreateMessageModel()
{
return new XMLMessageModel();
}
/**//// <summary>
/// 創建XMLMessage對象
/// </summary>
/// <returns></returns>
public override AbstractMessage CreateMessage()
{
return new XMLMessage();
}
}
}