Example #1
0
        /// <summary>
        ///     更新语句后处理(单个实体操作不引发)
        /// </summary>
        /// <param name="condition">执行条件</param>
        /// <param name="args">参数值</param>
        /// <param name="operatorType">操作类型</param>
        private void OnOperatorExecuted(string condition, IEnumerable <DbParameter> args, DataOperatorType operatorType)
        {
            var mySqlParameters = args as DbParameter[] ?? args.ToArray();

            OnOperatorExecuted(operatorType, condition, mySqlParameters);
            DataUpdateHandler.OnOperatorExecuted(this, condition, mySqlParameters, operatorType);
        }
Example #2
0
 /// <summary>
 ///     更新语句后处理(单个实体操作不引发)
 /// </summary>
 /// <param name="operatorType">操作类型</param>
 /// <param name="entity">其它参数</param>
 private Task OnEvent(DataOperatorType operatorType, TData entity)
 {
     if (!GlobalEvent)
     {
         return(Task.CompletedTask);
     }
     return(DataUpdateHandler.OnStatusChanged(DataBase.Name, Name, operatorType, EntityEventValueType.EntityJson, JsonConvert.SerializeObject(entity)));
 }
Example #3
0
 /// <summary>
 ///     更新语句后处理(单个实体操作不引发)
 /// </summary>
 /// <param name="operatorType">操作类型</param>
 /// <param name="key">其它参数</param>
 private Task OnKeyEvent(DataOperatorType operatorType, object key)
 {
     if (!GlobalEvent)
     {
         return(Task.CompletedTask);
     }
     return(DataUpdateHandler.OnStatusChanged(DataBase.Name, Name, operatorType, EntityEventValueType.Key, key?.ToString()));
 }
Example #4
0
        /// <summary>
        ///     与更新同时执行的SQL(更新之后立即执行)
        /// </summary>
        /// <param name="condition">当前场景的执行条件</param>
        /// <returns></returns>
        private string AfterUpdateSql(string condition)
        {
            if (NoInjection)
            {
                return(null);
            }
            var code = new StringBuilder();

            AfterUpdateSql(code, condition);
            DataUpdateHandler.AfterUpdateSql(this, code, condition);
            return(code.ToString());
        }
Example #5
0
        /// <summary>
        ///     更新语句后处理(单个实体操作不引发)
        /// </summary>
        private Task OnMulitUpdateEvent(DataOperatorType operatorType, string condition, DbParameter[] args)
        {
            if (!GlobalEvent)
            {
                return(Task.CompletedTask);
            }
            var queryCondition = new MulitCondition
            {
                Condition  = condition,
                Parameters = new ConditionParameter[args.Length]
            };

            for (int i = 0; i < args.Length; i++)
            {
                queryCondition.Parameters[i] = new ConditionParameter
                {
                    Name  = args[i].ParameterName,
                    Value = args[i].Value == DBNull.Value ? null : args[i].Value.ToString(),
                    Type  = args[i].DbType
                };
            }
            return(DataUpdateHandler.OnStatusChanged(DataBase.Name, Name, operatorType, EntityEventValueType.QueryCondition, JsonConvert.SerializeObject(queryCondition)));
        }
Example #6
0
 static SqliteTable()
 {
     DataUpdateHandler.InitType <TData>();
 }
Example #7
0
 /// <summary>
 ///     保存完成后期处理
 /// </summary>
 /// <param name="entity">保存的对象</param>
 /// <param name="operatorType">操作类型</param>
 private void OnDataSaved(TData entity, DataOperatorType operatorType)
 {
     OnDataSaved(operatorType, entity);
     DataUpdateHandler.OnDataSaved(entity, operatorType);
 }
Example #8
0
 /// <summary>
 ///     保存前处理
 /// </summary>
 /// <param name="entity">保存的对象</param>
 /// <param name="operatorType">操作类型</param>
 private void OnPrepareSave(TData entity, DataOperatorType operatorType)
 {
     OnPrepareSave(operatorType, entity);
     DataUpdateHandler.OnPrepareSave(entity, operatorType);
 }
Example #9
0
 static SqlServerTable()
 {
     DataUpdateHandler.InitType <TData>();
 }