/////////////////////////////////////////////////////////////////////////////
|
// File Description : 业务逻辑层基类
|
// Copyright : Han He
|
// -------------------------------------------------------------------------
|
// Date Created : Mar 26, 2009
|
// Author : jiangxinjun
|
// -------------------------------------------------------------------------
|
// Change History
|
// ~~~~~~~~~~~~~~
|
// Date Modified :
|
// Changed By :
|
// Change Description :
|
//
|
/////////////////////////////////////////////////////////////////////////////
|
|
using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using HH.AMS.DAL;
|
|
namespace HH.AMS.BLL
|
{
|
/// <summary>
|
/// 业务逻辑层基类
|
/// </summary>
|
public abstract class BaseBLL
|
{
|
private Dictionary<Type, object> cacheInstance;
|
|
internal Dictionary<Type, object> CacheInstance
|
{
|
get
|
{
|
if (cacheInstance == null)
|
{
|
cacheInstance = new Dictionary<Type, object>();
|
}
|
return cacheInstance;
|
}
|
}
|
|
internal T CreateDAL<T>()
|
where T : BaseDAL, new()
|
{
|
return CreateDAL<T>(true);
|
}
|
|
internal T CreateDAL<T>(bool isUseCache)
|
where T : BaseDAL, new()
|
{
|
if (!isUseCache)
|
{
|
return DAOManager.Create<T>();
|
}
|
|
Type type = typeof(T);
|
|
if (!CacheInstance.ContainsKey(type))
|
{
|
CacheInstance.Add(type, DAOManager.Create<T>());
|
}
|
|
return CacheInstance[type] as T;
|
}
|
}
|
}
|