Example #1
0
        public virtual void UpdateData(SessionResultData sessionResult)
        {
            SessionResultData           lastSessionResult = InternalGetSessionResult(sessionResult.RuntimeHash, sessionResult.Session);
            Dictionary <string, string> lastSessionValues = DataModelMapper.GetColumnValueMapping(lastSessionResult);

            Dictionary <string, string> columnToValue = DataModelMapper.GetColumnValueMapping(sessionResult);

            string filter = $"{DataBaseItemNames.RuntimeIdColumn}='{sessionResult.RuntimeHash}' AND {DataBaseItemNames.SessionIdColumn}={sessionResult.Session}";
            string cmd    = SqlCommandFactory.CreateUpdateCmd(DataBaseItemNames.SessionTableName, lastSessionValues,
                                                              columnToValue, filter);

            ExecuteWriteCommand(cmd);
        }
Example #2
0
        public virtual void UpdateData(TestInstanceData testInstance)
        {
            // 获取原数据,转换为键值对类型
            TestInstanceData            lastInstanceData   = InternalGetTestInstanceData(testInstance.RuntimeHash);
            Dictionary <string, string> lastInstanceValues = DataModelMapper.GetColumnValueMapping(lastInstanceData);

            Dictionary <string, string> columnToValue = DataModelMapper.GetColumnValueMapping(testInstance);
            // 比较并创建更新命令
            string filter = $"{DataBaseItemNames.RuntimeIdColumn}='{testInstance.RuntimeHash}'";
            string cmd    = SqlCommandFactory.CreateUpdateCmd(DataBaseItemNames.InstanceTableName, lastInstanceValues,
                                                              columnToValue, filter);

            if (string.IsNullOrWhiteSpace(cmd))
            {
                return;
            }
            ExecuteWriteCommand(cmd);
        }