/// <summary> /// 启动内存表数据管理,只能在主程序启动时调用一次 /// </summary> public static void Start() { //如果已经打开,那么直接退出 if (status == MemoryDataManagerStatus.Open) { return; } LogHelper.WriteDebug("启动内存表数据管理……"); bool isNormalExit; // = DaoUtil.IsNormalExitLastTime; //LogHelper.WriteDebug("上次是否正常退出:" + isNormalExit); //暂时不用,每次都同步数据库 isNormalExit = false; XHCapitalMemoryDBPersister xhCapitalMemoryDBPersister = new XHCapitalMemoryDBPersister(); XHCapitalMemoryList = new XHCapitalMemoryTableList(xhCapitalMemoryDBPersister); XHCapitalMemoryList.Initialize(isNormalExit); XHHoldMemoryDBPersister xhHoldMemoryDBPersister = new XHHoldMemoryDBPersister(); XHHoldMemoryList = new XHHoldMemoryTableList(xhHoldMemoryDBPersister); XHHoldMemoryList.Initialize(isNormalExit); QHCapitalMemoryDBPersister qhCapitalMemoryDBPersister = new QHCapitalMemoryDBPersister(); QHCapitalMemoryList = new QHCapitalMemoryTableList(qhCapitalMemoryDBPersister); QHCapitalMemoryList.Initialize(isNormalExit); QHHoldMemoryDBPersister qhHoldMemoryDBPersister = new QHHoldMemoryDBPersister(); QHHoldMemoryList = new QHHoldMemoryTableList(qhHoldMemoryDBPersister); QHHoldMemoryList.Initialize(isNormalExit); HKCapitalMemoryDBPersister hkCapitalMemoryDBPersister = new HKCapitalMemoryDBPersister(); HKCapitalMemoryList = new HKCapitalMemoryTableList(hkCapitalMemoryDBPersister); HKCapitalMemoryList.Initialize(isNormalExit); HKHoldMemoryDBPersister hkHoldMemoryDBPersister = new HKHoldMemoryDBPersister(); HKHoldMemoryList = new HKHoldMemoryTableList(hkHoldMemoryDBPersister); HKHoldMemoryList.Initialize(isNormalExit); LogHelper.WriteDebug("内存表数据管理初始化完成!"); status = MemoryDataManagerStatus.Open; }
/// <summary> /// 结束内存表数据管理,只能在主程序结束时调用一次 /// </summary> public static void End() { //如果已经关闭,那么直接退出 if (status == MemoryDataManagerStatus.Close) { return; } XHCapitalMemoryList.Commit(); XHHoldMemoryList.Commit(); QHCapitalMemoryList.Commit(); QHHoldMemoryList.Commit(); HKCapitalMemoryList.Commit(); HKHoldMemoryList.Commit(); LogHelper.WriteDebug("结束内存表数据管理……"); status = MemoryDataManagerStatus.Close; }