protected IDeleteBuilder BuilderParse(ParamDelete param) { var data = param.GetData(); var from = data.From.Length == 0 ? typeof(T).Name : data.From; var deleteBuilder = db.Delete(from); var where = GetSqlWhere(data.Where); if (data.Where.Exists(x => x.Symbol != "equal")) { foreach (var c in data.Where.Where(x => x.Symbol != "eqaul" && x.Parameters != null && x.Parameters.Count > 0)) { throw new Exception(string.Format("删除条件中的{0}未实现参数化!", c.Symbol)); } deleteBuilder.Where(where); } else { foreach (var c in data.Where) { deleteBuilder.Where(c.Column, c.Values[0]); } } return(deleteBuilder); }
public ParamDelete ToParamDelete() { var pDelete = ParamDelete.Instance(); pDelete.From(GetTableName()); EachWhere(c => pDelete.Where(builder => BuildCondition(builder, c))); return(pDelete); }
protected IDeleteBuilder BuilderParse(ParamDelete param) { var data = param.GetData(); var deleteBuilder = db.Delete(data.From.Length == 0 ? typeof(T).Name : data.From); deleteBuilder.Where(data.WhereSql); return(deleteBuilder); }
public ParamDelete ToParamDelete() { var settings = XElement.Parse(settingXml); var pDelete = ParamDelete.Instance().From(getXmlElementValue(settings, "table")); parseWhere(settings, (name, value, compare, variable, extend) => pDelete.AndWhere(name, value, compare, extend)); return(pDelete); }