/////////////////////////////////////////////////////////////////////////////
// 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.DAL;
using HH.Redis.ReisModel;
namespace HH.WMS.BLL
{
///
/// 业务逻辑层基类
///
public abstract class BaseBLL
{
public RedisUserEntity userInfo;
private Dictionary cacheInstance;
internal Dictionary CacheInstance
{
get
{
if (cacheInstance == null)
{
cacheInstance = new Dictionary();
}
return cacheInstance;
}
}
public T CreateDAL() where T : BaseDAL, new()
{
var v = CreateDAL(true);
v.userInfo = this.userInfo;
return v;
}
internal T CreateDAL(bool isUseCache) where T : BaseDAL, new()
{
if (!isUseCache)
{
var v = DAOManager.Create();
v.userInfo = this.userInfo;
return v;
}
Type type = typeof(T);
if (!CacheInstance.ContainsKey(type))
{
CacheInstance.Add(type, DAOManager.Create());
}
return CacheInstance[type] as T;
}
public T CreateOrgDapper(RedisUserEntity userInfo) where T : BaseDAL, new()
{
var entity = CreateDAL();
//entity.userInfo = userInfo;
return entity;
}
internal DapperDAL CreateDapperDAL() where T : new()
{
return CreateDAL>();
}
}
}