public ModelInvokeResult <ColumnPK> Delete(string strColumnName, string strTableName)
        {
            ModelInvokeResult <ColumnPK> result = new ModelInvokeResult <ColumnPK> {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                string   _ColumnName = strColumnName;
                string   _TableName  = strTableName;
                ColumnPK pk          = new ColumnPK {
                    ColumnName = _ColumnName, TableName = _TableName
                };
                DeleteCascade(statements, pk);
                statements.Add(new IBatisNetBatchStatement {
                    StatementName = new Column().GetDeleteMethodName(), ParameterObject = pk, Type = SqlExecuteType.DELETE
                });
                /***********************begin 自定义代码*******************/
                /***********************此处添加自定义代码*****************/
                /***********************end 自定义代码*********************/
                //BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements);
                result.instance = new ColumnPK {
                    ColumnName = _ColumnName, TableName = _TableName
                };
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }
 private void DeleteCascade(List <IBatisNetBatchStatement> statements, ColumnPK pk)
 {
     //SqlAdaper sqlAdaper = BuilderFactory.DefaultBulder().GetAdaper();
     //ISqlMapper mapper = sqlAdaper.BeginTransaction();
     //var obj = new object { };
     //List<IBatisNetBatchStatement> mapStatement = new List<IBatisNetBatchStatement>();
     try
     {
         //设置需要操作的参数
         string strParms = "{'TableName':'" + pk.TableName + "'}";
         //取得当前表非当前Id的数据
         string result = DeleteSelectedTable(strParms, statements.Count);
         if (result != null)
         {
             DeleteSelectedTableJoin(strParms);
         }
     }
     catch (Exception ex)
     {
         //sqlAdaper.RollBackTransaction(mapper);
         throw new Exception("级联删除出错", ex);
     }
 }
        public InvokeResult DeleteSelected2(string strColumnNameTableNames)
        {
            InvokeResult result = new InvokeResult {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                string[] arrColumnNameTableNames          = strColumnNameTableNames.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                if (arrColumnNameTableNames.Length == 0)
                {
                    result.Success   = false;
                    result.ErrorCode = 59996;
                    return(result);
                }
                string statementName = new Column().GetDeleteMethodName();
                foreach (string strColumnNameTableName in arrColumnNameTableNames)
                {
                    string[] arrColumnNameTableName = strColumnNameTableName.Split("-".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                    ColumnPK pk = new ColumnPK {
                        ColumnName = arrColumnNameTableName[0], TableName = arrColumnNameTableName[1]
                    };
                    DeleteCascade(statements, pk);
                    statements.Add(new IBatisNetBatchStatement {
                        StatementName = statementName, ParameterObject = pk, Type = SqlExecuteType.DELETE
                    });
                }
                //BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements);
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }