using System;
using System.Configuration;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QMFrameWork.ServiceLibrary;
using QMFrameWork.Cache;
namespace QMFrameWork.ServiceLibrary
{
///
/// 服务引擎
///
public class ServiceEngine
{
///
/// 启动
/// 服务资源路径
/// 服务资源列表文件
///
public static void Start(string businessDllPath, List serviceFiles)
{
//装配数据工厂
QMFrameWork.Data.DataFactory.Configure(true);
//加载静态基础数据
QMFrameWork.Common.Util.ModelDictionaryHandler.Configure();
//初始缓存
CacheManager.Config();
//启动数据实体缓存
DataEntityCache();
//加载业务服务
if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["ServiceCredential"]) == false)
AuthorizationManager.ServiceCredential = ConfigurationManager.AppSettings["ServiceCredential"];
ServiceFactory.BusinessDllPath = businessDllPath;
foreach (string file in serviceFiles)
{
ServiceFactory.Configure(file);
}
}
///
/// 停止
///
public static void Stop()
{
QMFrameWork.Data.DataFactory.Stop();
EntityCacheManager.Stop();
}
//启动数据实体缓存
public static void DataEntityCache()
{
#region 定义
EntityCacheManager.DayCacheHelperList = new List();
//用户信息缓存
//EntityCacheHelper userCacheHelper = new EntityCacheHelper();
//userCacheHelper.GetListTool = new QMAPP.BLL.DataCache.GetUserCacheBLL();
//EntityCacheManager.DayCacheHelperList.Add(userCacheHelper);
#endregion
//设置
EntityCacheManager.DayCacheLoadTime = TimeSpan.Parse("00:10:00");
//启动
EntityCacheManager.Start();
}
}
}