Search Results for

    Show / Hide Table of Contents

    Class QueryableFilter

    Contains information on filtering a set of items. Can contain child QueryableFilters forming a filter like the following:

    And

    --- XXX Equals 123

    --- Or

    ------ YYY Equals 123

    ------ ZZZ NotEquals 321

    Inheritance
    object
    BaseHasChildren<QueryableFilter>
    QueryableFilter
    Implements
    IHasChildren<QueryableFilter>
    IHasChildren
    ICloneable
    ICloneable<QueryableFilter>
    Inherited Members
    BaseHasChildren<QueryableFilter>.AddChild(QueryableFilter, bool)
    BaseHasChildren<QueryableFilter>.DeleteChild(QueryableFilter)
    BaseHasChildren<QueryableFilter>.ClearChildren()
    BaseHasChildren<QueryableFilter>.ClearMyParent()
    BaseHasChildren<QueryableFilter>.AddChild(IHasChildren)
    BaseHasChildren<QueryableFilter>.DeleteChild(IHasChildren)
    BaseHasChildren<QueryableFilter>.Order
    BaseHasChildren<QueryableFilter>.Children
    BaseHasChildren<QueryableFilter>.Parent
    object.GetType()
    object.MemberwiseClone()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: LemonEdge.Utils
    Assembly: LemonEdge.Utils.dll
    Syntax
    [DataContract(IsReference = true)]
    public class QueryableFilter : BaseHasChildren<QueryableFilter>, IHasChildren<QueryableFilter>, IHasChildren, ICloneable, ICloneable<QueryableFilter>

    Constructors

    QueryableFilter(GroupType)

    Creates a new QueryableFilter with a heirarchical grouping, representing the logical operator that should be applied when combining all child QueryableFilters together

    Declaration
    public QueryableFilter(GroupType group)
    Parameters
    Type Name Description
    GroupType group

    The logical operator to apply to the child QueryableFilters

    Remarks

    This allows you to build hierarchical where filters that would represent operations such as where (XXX Equals 123 OR (YYY Equals 456 AND ZZZ NotEquals 789))

    QueryableFilter(GroupType, IEnumerable<QueryableFilter>)

    Creates a new QueryableFilter with a heirarchical grouping, representing the logical operator that should be applied when combining all child QueryableFilters together

    Declaration
    public QueryableFilter(GroupType group, IEnumerable<QueryableFilter> children)
    Parameters
    Type Name Description
    GroupType group

    The logical operator to apply to the child QueryableFilters

    IEnumerable<QueryableFilter> children

    The initial QueryableFilters to set as child filters for this QUeryableFilter

    Remarks

    This allows you to build hierarchical where filters that would represent operations such as where (XXX Equals 123 OR (YYY Equals 456 AND ZZZ NotEquals 789))

    QueryableFilter(string, SQLOperator, object, bool)

    Create a new QueryableFilter that checks if the specified property propName matches the value when the operator op is applied

    Declaration
    public QueryableFilter(string propName, SQLOperator op, object value, bool isCaseInsensitive = false)
    Parameters
    Type Name Description
    string propName

    The property to check against the value

    SQLOperator op

    The operator to use as a comparison between the property and specified value

    object value

    The value to check against the property

    bool isCaseInsensitive

    Whether the comparison is case-insensitive or not

    QueryableFilter(string, string, SQLOperator, bool)

    Creates a new QueryableFilter that checks if the values for properties propName and propName2 match when the operator op is applied to them both

    Declaration
    public QueryableFilter(string propName, string propName2, SQLOperator op, bool isCaseInsensitive = false)
    Parameters
    Type Name Description
    string propName

    The first property to compare

    string propName2

    The second property to compare

    SQLOperator op

    The operator to use for the comparison

    bool isCaseInsensitive

    Whether the comparison is case-insensitive or not

    Properties

    ComparisonPropertyName

    The property to compare the PropertyName to using the Op operator

    Declaration
    public string ComparisonPropertyName { get; }
    Property Value
    Type Description
    string

    Group

    If this filter holds child filters, this is the logical operator used to compare all child filters together (AND or OR)

    Declaration
    public GroupType? Group { get; }
    Property Value
    Type Description
    GroupType?

    IsCaseInsensitive

    Whether the query should be treated as case-insensitive in its comparison

    Declaration
    public bool IsCaseInsensitive { get; }
    Property Value
    Type Description
    bool

    Op

    The operation to use to compare the property to a value or other property

    Declaration
    public SQLOperator Op { get; set; }
    Property Value
    Type Description
    SQLOperator

    PropertyName

    The name of the property to compare to a value or other property

    Declaration
    public string PropertyName { get; set; }
    Property Value
    Type Description
    string

    Type

    The type of the property this filter is comparing

    Declaration
    public Type Type { get; set; }
    Property Value
    Type Description
    Type

    Value

    The value to compare the PropertyName to using the Op operator

    Declaration
    public object Value { get; set; }
    Property Value
    Type Description
    object

    ValueIsOtherProperty

    Indicates if the comparrison for this filter is against ComparisonPropertyName rather than a hardcoded Value

    Declaration
    public bool ValueIsOtherProperty { get; }
    Property Value
    Type Description
    bool

    Methods

    Clone()

    Creates a new QueryableFilter that is the same inheriting type as this current one and sets all the values of it to the same as this one

    Declaration
    public QueryableFilter Clone()
    Returns
    Type Description
    QueryableFilter

    A new QueryableFilter that is the same inheriting type as this current one and sets all the values of it to the same as this one

    CopyFromSource(QueryableFilter)

    Implementation of CopyFromSource(T). Sets all values of this QueryableFilter to the same as the supplied source

    Declaration
    public void CopyFromSource(QueryableFilter source)
    Parameters
    Type Name Description
    QueryableFilter source

    A source QueryableFilter to copy all values from

    CopyFromSource(object)

    Implementation of CopyFromSource(object). Sets all values of this QueryableFilter to the same as the supplied source

    Declaration
    public void CopyFromSource(object source)
    Parameters
    Type Name Description
    object source

    A source QueryableFilter to copy all values from

    ParseWhere(Func<string, Type>, string)

    Creates a new QueryableFilter using the specified filter of the form XXX OP VALUE

    Declaration
    public static QueryableFilter ParseWhere(Func<string, Type> resolveTypeFromName, string filter)
    Parameters
    Type Name Description
    Func<string, Type> resolveTypeFromName

    A function that given a property name returns the type of that property so the value in the filter can be parsed and evaluated correctly

    string filter

    The filter to parse in the form XXX OP VALUE

    Returns
    Type Description
    QueryableFilter

    A new QueryableFilter that applies a where filter of the form XXX OP VALUE

    ParseWhere(Type, string)

    Creates a new QueryableFilter for the given forType using the specified filter of the form XXX OP YYY

    Declaration
    public static QueryableFilter ParseWhere(Type forType, string filter)
    Parameters
    Type Name Description
    Type forType

    The type of item this where clause would be operating against

    string filter

    The filter to parse in the form XXX OP YYY

    Returns
    Type Description
    QueryableFilter

    A new QueryableFilter that applies a where filter of the form XXX OP YYY

    ToExpression<T>(bool)

    Converts this QueryableFilter into a Expression<TDelegate> of Func<T, TResult> returning a bool so this expression can be directly mapped to Linq

    Declaration
    public Expression<Func<T, bool>> ToExpression<T>(bool oDataQuery)
    Parameters
    Type Name Description
    bool oDataQuery

    Indicates if this filter is to be applied against an odata query or not

    Returns
    Type Description
    Expression<Func<T, bool>>

    A Expression<TDelegate> of Func<T, TResult> returning a bool so this expression can be directly mapped to Linq

    Type Parameters
    Name Description
    T

    The item type this filter query expression operates on

    Remarks

    This function runs recursively on any children this QueryableFilter has to translate an expression of the form (XXX Equals 123 OR (YYY Equals 456 AND ZZZ NotEquals 789)) into an equivelant Linq expression tree

    ToString()

    Returns the filter in a human readable format such as (XXX Equals 123 OR (YYY Equals 456 AND ZZZ NotEquals 789))

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    The filter in a human readable format such as (XXX Equals 123 OR (YYY Equals 456 AND ZZZ NotEquals 789))

    Overrides
    object.ToString()

    Implements

    IHasChildren<T>
    IHasChildren
    ICloneable
    ICloneable<T>

    Extension Methods

    HasChildrenExtensions.GetAllChildren(IHasChildren)
    HasChildrenExtensions.GetLeafChildNodesOnly(IHasChildren)
    HasChildrenExtensions.GetRootParent(IHasChildren)
    HasChildrenExtensions.HasChildren(IHasChildren)
    HasChildrenExtensions.MaxTreeDepth(IHasChildren)
    HasChildrenExtensions.GetAllChildren<T>(IHasChildren<T>)
    HasChildrenExtensions.ContainsMatchingNode<T>(T, Func<T, bool>)
    HasChildrenExtensions.CopyNode<T>(T, HasChildrenExtensions.CreateCopiedNode<T>)
    HasChildrenExtensions.CopyNode<T>(T, T, HasChildrenExtensions.CreateCopiedNode<T>)
    HasChildrenExtensions.GetLeafChildNodesOnly<T>(T)
    HasChildrenExtensions.GetMatchingNode<T>(T, Func<T, bool>)
    HasChildrenExtensions.GetPath<T>(T, string, Func<T, string>)
    HasChildrenExtensions.GetRootParent<T>(T)
    HasChildrenExtensions.GetRootToNode<T>(T)
    LinqExtensions.AsArray<T>(T)
    LinqExtensions.ToArrayOfOne<T>(T)
    LinqExtensions.ToListOfOne<T>(T)
    MiscExtensions.SetIfNotEqual<T, TP>(T, Expression<Func<T, TP>>, TP)
    QueryableFilterExtensions.Combine(QueryableFilter, QueryableFilter, GroupType)
    WeakReferenceExtensions.WeakReference(object)
    SQLExtensions.ToSQLValue(object, bool)
    ReflectionExtensions.ClearEventInvocations(object, string)
    StringExtensions.ToCSVFormatString(object, Type)

    See Also

    QueryableExecuter
    QueryableExecuter<T>
    QueryableExecuter<T, TT>
    In this article
    Back to top © LemonEdge Technologies. All rights reserved.