return mySingleton;
}
}
其实在一些项目中,单例模式早就有了体现。在开发asp.net的项目中,就已经用这种方法来包装http上下文来实现计算机资源的节省。
复制代码
/// <summary>
/// 业务仓储
/// </summary>
public IBLL.IBLLSession BLLSession;
//---------------------定义上下文属性
#region 实例构造函数 初始化业务仓储 + OperateContext()
public OperateContext()
{
BLLSession = DI.SpringHelper.GetObject<IBLL.IBLLSession>("BLLSession");
}
#endregion
#region Http上下文 以及相关属性
/// <summary>
/// Http上下文
/// </summary>
HttpContext ContextHttp
{
get
{
return HttpContext.Current;
}
}
HttpResponse Response
{
get
{
return ContextHttp.Response;
}
}
HttpRequest Request










