/// <summary> /// Creates an XPath filter for the specified object type and attribute value pair /// </summary> /// <param name="objectType">The object type to query</param> /// <param name="attributeName">The name of the attribute to query</param> /// <param name="comparisonOperator">The operator used to compare the attribute and value</param> /// <param name="attributeValue">The value of the attribute to query</param> /// <returns>An XPath query string</returns> public static string CreateFilter(string objectType, string attributeName, ComparisonOperator comparisonOperator, object attributeValue) { AttributeValuePairCollection dictionary = new AttributeValuePairCollection(); dictionary.Add(attributeName, attributeValue); return(XPathFilterBuilder.CreateFilter(objectType, dictionary, comparisonOperator, GroupOperator.And)); }
/// <summary> /// Initializes a new instance of the XpathQueryGroup class /// </summary> /// <param name="groupOperator">The logical operator to apply to queries within this group</param> /// <param name="attributeValuePairs">The attribute and value pairs to query</param> /// <param name="valueComparisonOperator">The operator to apply to the individual attribute and value pairs</param> public XPathQueryGroup(GroupOperator groupOperator, AttributeValuePairCollection attributeValuePairs, ComparisonOperator valueComparisonOperator) { this.Queries = new List <IXPathQueryObject>(); foreach (AttributeValuePair value in attributeValuePairs) { this.Queries.Add(new XPathQuery(value.AttributeName, valueComparisonOperator, value.Value)); } this.GroupOperator = groupOperator; }
/// <summary> /// Creates an XPath filter for the specified object type and attribute/value pairs. Multiple pairs are joined with an 'and' operator /// </summary> /// <param name="objectType">The object type to query</param> /// <param name="keyValuePairs">The list to attribute and value pairs to query for</param> /// <param name="valueComparisonOperator">The operator used to compare the attribute and value pairs</param> /// <param name="groupOperator">The operator to use to join the attribute value pair comparisons together</param> /// <returns>An XPath query string</returns> public static string CreateFilter(string objectType, AttributeValuePairCollection keyValuePairs, ComparisonOperator valueComparisonOperator, GroupOperator groupOperator) { return(XPathFilterBuilder.CreateFilter(objectType, new XPathQueryGroup(groupOperator, keyValuePairs, valueComparisonOperator))); }
/// <summary> /// Creates a filter that dereferences a matching expression, and returns the resulting values from the referenced attribute /// </summary> /// <param name="searchObjectType">The object type to query</param> /// <param name="keyValuePairs">The list to attribute and value pairs to query for</param> /// <param name="valueComparisonOperator">The operator used to compare the attribute and value pairs</param> /// <param name="groupOperator">The operator to use to join the attribute value pair comparisons together</param> /// <param name="referenceAttributeName">The name of the attribute used to dereference the expression</param> /// <returns>An XPath query string</returns> public static string CreateDereferenceFilter(string searchObjectType, AttributeValuePairCollection keyValuePairs, ComparisonOperator valueComparisonOperator, GroupOperator groupOperator, string referenceAttributeName) { XPathQueryGroup predicate = new XPathQueryGroup(groupOperator, keyValuePairs, valueComparisonOperator); return(XPathFilterBuilder.CreateDereferenceFilter(searchObjectType, predicate, referenceAttributeName)); }