/*------------------------------------------------------------------
-- COPYRIGHT (C) 2010-2012 PFC
-- ALL RIGHTS RESERVED.
-- 汉和信息
-- CREATE DATE: 2010/08/05
-- CREATE MAN: 姜新军
-- 业务逻辑层基类
-- MODIFY HISTORY:
-- MODIFY DATE:
-- MODIFY MAN:
-- MODIFY DESC:
-- MODIFY DATE:
-- MODIFY MAN:
-- MODIFY DESC:
---------------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Text;
using HW.DAL;
namespace HW.BLL
{
///
/// 业务逻辑层基类
///
public abstract class BaseBLL
{
private Dictionary cacheInstance;
internal Dictionary CacheInstance
{
get
{
if (cacheInstance == null)
{
cacheInstance = new Dictionary();
}
return cacheInstance;
}
}
internal T CreateDAL()
where T : BaseDAL, new()
{
return CreateDAL(true);
}
internal T CreateDAL(bool isUseCache)
where T : BaseDAL, new()
{
if (!isUseCache)
{
return DAOManager.Create();
}
Type type = typeof(T);
if (!CacheInstance.ContainsKey(type))
{
CacheInstance.Add(type, DAOManager.Create());
}
return CacheInstance[type] as T;
}
}
}