public string StringContains(CRLExpression.MethodCallObj methodInfo, ref int parIndex, AddParameHandler addParame) { var field = methodInfo.MemberQueryName; var nodeType = methodInfo.ExpressionType; var args = methodInfo.Args; string parName = string.Format("@contrains{0}", parIndex); var args1 = args[0]; if (args1 is ExpressionValueObj) { parName = args1.ToString(); } else { addParame(parName, args1); } parIndex += 1; if (nodeType == ExpressionType.Equal) { return(dBAdapter.StringContainsFormat(field, parName)); } else { return(dBAdapter.StringNotContainsFormat(field, parName)); } //return string.Format("CHARINDEX({1},{0})>0", field, parName); }
/// <summary> /// 字符串包含 /// </summary> /// <param name="methodInfo"></param> /// <param name="parIndex"></param> /// <param name="addParame"></param> /// <returns></returns> public string Contains(CRLExpression.MethodCallObj methodInfo, ref int parIndex, AddParameHandler addParame) { var field = methodInfo.MemberQueryName; var nodeType = methodInfo.ExpressionType; var args = methodInfo.Args; var firstArgs = args.First(); if (firstArgs is IEnumerable && firstArgs.GetType() != typeof(string))//如果是集合,按in { return(In(methodInfo, ref parIndex, addParame)); } string parName = GetParamName("contains", parIndex); var args1 = args[0]; if (args1 is ExpressionValueObj) { parName = args1.ToString(); } else { addParame(parName, args1); } parIndex += 1; if (nodeType == ExpressionType.Equal) { return(dBAdapter.StringContainsFormat(field, parName)); } else { return(dBAdapter.StringNotContainsFormat(field, parName)); } //return string.Format("CHARINDEX({1},{0})>0", field, parName); }
public string StringContains(string field, ref int parIndex, AddParameHandler addParame, object[] args) { string parName = string.Format("@contrains{0}", parIndex); addParame(parName, args[0]); return(dBAdapter.StringContainsFormat(field, parName)); //return string.Format("CHARINDEX({1},{0})>0", field, parName); }
public string StringContains(string field, ExpressionType nodeType, ref int parIndex, AddParameHandler addParame, object[] args) { string parName = string.Format("@contrains{0}", parIndex); addParame(parName, args[0]); parIndex += 1; if (nodeType == ExpressionType.Equal) { return(dBAdapter.StringContainsFormat(field, parName)); } else { return(dBAdapter.StringNotContainsFormat(field, parName)); } //return string.Format("CHARINDEX({1},{0})>0", field, parName); }