///////////////////////////////////////////////////////////////////////////// // 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.WMS.CoreServer.DAL; namespace HH.WMS.CoreServer.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; } } }