[索引页]
[源码下载]


乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)


作者:webabcd


介绍
运用共享技术有效地支持大量细粒度的对象。


示例
有一个Message实体类,某些对象对它的操作有Insert()和Get()方法,现在要运用共享技术支持这些对象。
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)


MessageModel
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)using System;
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
using System.Collections.Generic;
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
using System.Text;
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
namespace Pattern.Flyweight

AbstractMessage
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)using System;
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
using System.Collections.Generic;
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
using System.Text;
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
namespace Pattern.Flyweight

SqlMessage
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)using System;
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
using System.Collections.Generic;
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
using System.Text;
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
namespace Pattern.Flyweight

XmlMessage
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)using System;
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
using System.Collections.Generic;
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
using System.Text;
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
namespace Pattern.Flyweight

MessageFactory
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)using System;
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
using System.Collections.Generic;
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
using System.Text;
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
namespace Pattern.Flyweight


Test
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)using System;
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
using System.Data;
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
using System.Configuration;
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
using System.Collections;
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
using System.Web;
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
using System.Web.Security;
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
using System.Web.UI;
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
using System.Web.UI.WebControls;
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
using System.Web.UI.WebControls.WebParts;
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
using System.Web.UI.HtmlControls;
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
using Pattern.Flyweight;
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
乐在其中设计模式(C#) - 享元模式(Flyweight Pattern)
public partial class Flyweight : System.Web.UI.Page

运行结果
True
SQL方式获取Message 2007-5-17 22:20:38
True
XML方式获取Message 2007-5-17 22:20:38


参考
http://www.dofactory.com/Patterns/PatternFlyweight.aspx


OK
[源码下载]

相关文章: