public void BeginGroupCondition(QueryConditionRelationType groupRelationType) { m_conditions.Add(new LeftBracketCondition() { GroupConditionRelationType = groupRelationType }); }
private static void BuilCondition <Q>(Q filter, string dataType, List <FilterField> filterFields, DynamicQuerySqlBuilder sqlBuilder) { sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "r.BusinessDataType", DbType.String, "@BusinessDataType", QueryConditionOperatorType.Equal, dataType); List <string> changeTypes = new List <string>() { "A", "U" }; sqlBuilder.ConditionConstructor.AddInCondition(QueryConditionRelationType.AND, "r.ChangeType", DbType.String, changeTypes); int index = 0; filterFields.ForEach(p => { object parameterValue = Invoker.PropertyGet(filter, p.Name); string[] pNames = p.ValuePath.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries); string path = string.Format("(//{0}/text())[1]", pNames.Join("/")); DbType dbType = GetDbType(p.DBType); string field = string.Format("r.BusinessData.value('{0}','{1}')", path, p.DBType); QueryConditionOperatorType operatorType = GetEnum <QueryConditionOperatorType>(p.OperatorType); QueryConditionRelationType relationType = GetEnum <QueryConditionRelationType>(p.RelationType); sqlBuilder.ConditionConstructor.AddCondition(relationType, field, dbType, "@Parameter" + index.ToString(), operatorType, parameterValue); index++; }); }
public void AddCustomCondition(QueryConditionRelationType conditionRelationType, string customQueryString) { m_conditions.Add(new CustomCondition() { ConditionRelationType = conditionRelationType, CustomQueryString = customQueryString }); }
public void AddCondition( QueryConditionRelationType conditionRelationType, string fieldName, DbType parameterDbType, string parameterName, QueryConditionOperatorType conditionOperatorType, object parameterValue) { AddCondition(conditionRelationType, fieldName, parameterDbType, parameterName, conditionOperatorType, parameterValue, DefaultParameterValueValidationCheck); }
public void AddBetweenCondition( QueryConditionRelationType conditionRelationType, string fieldName, DbType parameterDbType, string parameterName, QueryConditionOperatorType leftConditionOperatorType, QueryConditionOperatorType rightConditionOperatorType, object leftParameterValue, object rightParameterValue) { AddBetweenCondition(conditionRelationType, fieldName, parameterDbType, parameterName, leftConditionOperatorType, rightConditionOperatorType, leftParameterValue, rightParameterValue, DefaultParameterValueValidationCheck); }
private void AddInOrNotInCondition(QueryConditionOperatorType operationType, QueryConditionRelationType conditionRelationType, string fieldName, DbType listValueDbType, List <Object> inValues) { if (operationType != QueryConditionOperatorType.In && operationType != QueryConditionOperatorType.NotIn) { throw new ArgumentException("Operation Type must be 'In' or 'NotIn'."); } AddCondition(conditionRelationType, fieldName, listValueDbType, null, operationType, inValues, value => { return(inValues != null && inValues.Count > 0); }); }
public void AddNullCheckCondition( QueryConditionRelationType conditionRelationType, string fieldName, QueryConditionOperatorType conditionOperatorType) { if (conditionOperatorType != QueryConditionOperatorType.IsNull && conditionOperatorType != QueryConditionOperatorType.IsNotNull) { throw new ArgumentException("Parameter conditionOperatorType must be IsNull or IsNotNull in this method."); } AddCondition(conditionRelationType, fieldName, DbType.Object, null, conditionOperatorType, null, value => { return(true); }); }
public void AddBetweenCondition( QueryConditionRelationType conditionRelationType, string fieldName, DbType parameterDbType, string parameterName, QueryConditionOperatorType leftConditionOperatorType, QueryConditionOperatorType rightConditionOperatorType, object leftParameterValue, object rightParameterValue, ParameterValueValidateCheckDelegate parameterValueValidateCheckHandler) { BeginGroupCondition(conditionRelationType); AddCondition(QueryConditionRelationType.AND, fieldName, parameterDbType, parameterName + "_Left", leftConditionOperatorType, leftParameterValue, parameterValueValidateCheckHandler); AddCondition(QueryConditionRelationType.AND, fieldName, parameterDbType, parameterName + "_Right", rightConditionOperatorType, rightParameterValue, parameterValueValidateCheckHandler); EndGroupCondition(); }
private void AddInOrNotInCondition <TListValueType>(QueryConditionOperatorType operationType, QueryConditionRelationType conditionRelationType, string fieldName, DbType listValueDbType, List <TListValueType> inValues) { List <Object> convertedInValues = new List <object>(); if (inValues != null) { foreach (TListValueType element in inValues) { convertedInValues.Add(element); } } AddInOrNotInCondition(operationType, conditionRelationType, fieldName, listValueDbType, convertedInValues); }
public ConditionConstructor AddSubQueryCondition(QueryConditionRelationType conditionRelationType, string filedName, QueryConditionOperatorType conditionOperatorType, string subQuerySQLTemplate) { if (!IsStringNullOrEmpty(subQuerySQLTemplate)) { SubQueryCondition condition = new SubQueryCondition() { ConditionRelationType = conditionRelationType, FieldName = filedName, OperatorType = conditionOperatorType, SubQuerySQLTemplate = subQuerySQLTemplate, SubQueryConditions = new List <Condition>() }; m_conditions.Add(condition); ConditionConstructor result = new ConditionConstructor(condition.SubQueryConditions); return(result); } return(null); }
public void AddCondition( QueryConditionRelationType conditionRelationType, string fieldName, DbType parameterDbType, string parameterName, QueryConditionOperatorType conditionOperatorType, object parameterValue, ParameterValueValidateCheckDelegate parameterValueValidateCheckHandler) { if (parameterValueValidateCheckHandler == null) { parameterValueValidateCheckHandler = DefaultParameterValueValidationCheck; } if (parameterValueValidateCheckHandler(parameterValue)) { m_conditions.Add(new SqlCondition { ConditionRelationType = conditionRelationType, ParameterDbType = parameterDbType, FieldName = fieldName, ParameterName = parameterName, OperatorType = conditionOperatorType, ParameterValue = parameterValue }); } }
public void AddNotInCondition <TListValueType>(QueryConditionRelationType conditionRelationType, string fieldName, DbType listValueDbType, List <TListValueType> inValues) { AddInOrNotInCondition <TListValueType>(QueryConditionOperatorType.NotIn, conditionRelationType, fieldName, listValueDbType, inValues); }
public GroupCondition(DynamicQuerySqlBuilder builder, QueryConditionRelationType groupRelationType) { m_builder = builder; m_builder.ConditionConstructor.BeginGroupCondition(groupRelationType); }