private CriteriaOperatorExtractor GetBinaryOperatorExtractor(CriteriaOperator criteriaOperator) { var binaryOperatorExtractor = new CriteriaOperatorExtractor(); binaryOperatorExtractor.Extract(criteriaOperator); return(binaryOperatorExtractor); }
public void ExtractGroupOperator() { BinaryOperator binaryOperator2; CriteriaOperator groupOperator; BinaryOperator binaryOperator = getGroupOperator(out binaryOperator2, out groupOperator); var extractor = new CriteriaOperatorExtractor(); extractor.Extract(groupOperator); Assert.AreEqual(binaryOperator, extractor.BinaryOperators[0]); Assert.AreEqual(binaryOperator2, extractor.BinaryOperators[1]); }
public void ExtractGroupOperator() { int dayOfYear = DateTime.Now.DayOfYear; BinaryOperator binaryOperator2; CriteriaOperator groupOperator; BinaryOperator binaryOperator = getGroupOperator(out binaryOperator2, out groupOperator); var extractor = new CriteriaOperatorExtractor(); extractor.Extract(groupOperator); Assert.AreEqual(binaryOperator, extractor.BinaryOperators[0]); Assert.AreEqual(binaryOperator2, extractor.BinaryOperators[1]); }
public void ExtractNestedGroupOperator() { BinaryOperator binaryOperator2; CriteriaOperator nestedGroupOperator; BinaryOperator binaryOperator1 = getGroupOperator(out binaryOperator2, out nestedGroupOperator); var groupOperator = new GroupOperator(nestedGroupOperator, binaryOperator1, binaryOperator2); CriteriaOperator containsOperator = new ContainsOperator("", groupOperator); var extractor = new CriteriaOperatorExtractor(); extractor.Extract(containsOperator); Assert.AreEqual(4, extractor.BinaryOperators.Count); Assert.AreEqual(binaryOperator1, extractor.BinaryOperators[0]); Assert.AreEqual(binaryOperator2, extractor.BinaryOperators[1]); Assert.AreEqual(binaryOperator1, extractor.BinaryOperators[2]); Assert.AreEqual(binaryOperator2, extractor.BinaryOperators[3]); }
public SelectStatement ApplyCondition(SelectStatement statement) { var extractor = new CriteriaOperatorExtractor(); extractor.Extract(statement.Condition); foreach (FilterProviderBase provider in FilterProviderManager.Providers) { FilterProviderBase providerBase = FilterProviderManager.GetFilterProvider(statement.TableName, provider.FilterMemberName, StatementContext.Select); if (providerBase != null) { IEnumerable <BinaryOperator> binaryOperators = GetBinaryOperators(extractor, providerBase); if (!FilterIsShared(statement.TableName, providerBase.Name) && !binaryOperators.Any()) { string nodeAlias = GetNodeAlias(statement, providerBase); ApplyCondition(statement, providerBase, nodeAlias); } } } return(statement); }
private CriteriaOperatorExtractor GetBinaryOperatorExtractor(CriteriaOperator criteriaOperator) { var binaryOperatorExtractor = new CriteriaOperatorExtractor(); binaryOperatorExtractor.Extract(criteriaOperator); return binaryOperatorExtractor; }
public SelectStatement ApplyCondition(SelectStatement statement) { var extractor = new CriteriaOperatorExtractor(); extractor.Extract(statement.Condition); traceStatement(statement, "ApplyCondition"); foreach (FilterProviderBase provider in FilterProviderManager.Providers){ FilterProviderBase providerBase = FilterProviderManager.GetFilterProvider(provider.FilterMemberName, StatementContext.Select); if (providerBase!= null){ Tracing.Tracer.LogVerboseValue("providerName", providerBase.Name); IEnumerable<BinaryOperator> binaryOperators = GetBinaryOperators(extractor, providerBase); if (!FilterIsShared(statement.TableName,providerBase.Name) && binaryOperators.Count() == 0&&!IsSystemTable(statement.TableName)){ string nodeAlias = GetNodeAlias(statement, providerBase); ApplyCondition(statement, providerBase, nodeAlias); } } } return statement; }