public override void FilterByProperty(string propertyName, IEnumerable allowedPropertyValues, bool wildcardsEnabled, BehaviorOnNoMatch behaviorOnNoMatch) { this.ClientSideQuery.FilterByProperty(propertyName, allowedPropertyValues, wildcardsEnabled, behaviorOnNoMatch); string matchCondition = CimQuery.GetMatchCondition(propertyName, allowedPropertyValues, wildcardsEnabled); if (!string.IsNullOrWhiteSpace(matchCondition)) { this.AddWqlCondition(matchCondition); } }
public override void ExcludeByProperty(string propertyName, IEnumerable excludedPropertyValues, bool wildcardsEnabled, BehaviorOnNoMatch behaviorOnNoMatch) { this.ClientSideQuery.ExcludeByProperty(propertyName, excludedPropertyValues, wildcardsEnabled, behaviorOnNoMatch); string matchCondition = CimQuery.GetMatchCondition(propertyName, excludedPropertyValues, wildcardsEnabled); if (!string.IsNullOrWhiteSpace(matchCondition)) { object[] objArray = new object[1]; objArray[0] = matchCondition; string str = string.Format(CultureInfo.InvariantCulture, "NOT ({0})", objArray); this.AddWqlCondition(str); } }
/// <summary> /// Modifies the query, so that it does not return objects with a given property value /// </summary> /// <param name="propertyName">Property name to query on</param> /// <param name="excludedPropertyValues">Property values to reject in the query</param> /// <param name="wildcardsEnabled"> /// <c>true</c> if <paramref name="excludedPropertyValues"/> should be treated as a <see cref="System.String"/> containing a wildcard pattern; /// <c>false otherwise</c> /// </param> /// <param name="behaviorOnNoMatch"> /// Describes how to handle filters that didn't match any objects /// </param> public override void ExcludeByProperty(string propertyName, IEnumerable excludedPropertyValues, bool wildcardsEnabled, BehaviorOnNoMatch behaviorOnNoMatch) { this.ClientSideQuery.ExcludeByProperty(propertyName, excludedPropertyValues, wildcardsEnabled, behaviorOnNoMatch); string positiveWqlCondition = CimQuery.GetMatchCondition(propertyName, excludedPropertyValues, wildcardsEnabled); if (!string.IsNullOrWhiteSpace(positiveWqlCondition)) { string condition = string.Format( CultureInfo.InvariantCulture, "NOT ({0})", positiveWqlCondition); this.AddWqlCondition(condition); } }