天津投入产出系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.3 KiB

using System;
using System.Configuration;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QMFrameWork.ServiceLibrary;
using QMFrameWork.Cache;
namespace QMFrameWork.ServiceLibrary
{
/// <summary>
/// 服务引擎
/// </summary>
public class ServiceEngine
{
/// <summary>
/// 启动
/// <param name="businessDllList">服务资源路径</param>
/// <param name="businessDllPath">服务资源列表文件</param>
/// </summary>
public static void Start(string businessDllPath, List<string> 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);
}
}
/// <summary>
/// 停止
/// </summary>
public static void Stop()
{
QMFrameWork.Data.DataFactory.Stop();
EntityCacheManager.Stop();
}
//启动数据实体缓存
public static void DataEntityCache()
{
#region 定义
EntityCacheManager.DayCacheHelperList = new List<IEntityCacheHelper>();
//用户信息缓存
//EntityCacheHelper<UserCacheInfo> userCacheHelper = new EntityCacheHelper<UserCacheInfo>();
//userCacheHelper.GetListTool = new QMAPP.BLL.DataCache.GetUserCacheBLL();
//EntityCacheManager.DayCacheHelperList.Add(userCacheHelper);
#endregion
//设置
EntityCacheManager.DayCacheLoadTime = TimeSpan.Parse("00:10:00");
//启动
EntityCacheManager.Start();
}
}
}