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
    System.Object
    BaseHasChildren<QueryableFilter>
    QueryableFilter
    Implements
    IHasChildren<QueryableFilter>
    IHasChildren
    ICloneable
    ICloneable<QueryableFilter>
    Inherited Members
    BaseHasChildren<QueryableFilter>.Order
    BaseHasChildren<QueryableFilter>.Children
    BaseHasChildren<QueryableFilter>.AddChild(QueryableFilter)
    BaseHasChildren<QueryableFilter>.DeleteChild(QueryableFilter)
    BaseHasChildren<QueryableFilter>.ClearChildren()
    BaseHasChildren<QueryableFilter>.Parent
    BaseHasChildren<QueryableFilter>.AddChild(IHasChildren)
    BaseHasChildren<QueryableFilter>.DeleteChild(IHasChildren)
    BaseHasChildren<QueryableFilter>.IHasChildren.Children
    BaseHasChildren<QueryableFilter>.IHasChildren.Parent
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: LemonEdge.Utils
    Assembly: 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

    System.Collections.Generic.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)

    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)
    Parameters
    Type Name Description
    System.String propName

    The property to check against the value

    SQLOperator op

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

    System.Object value

    The value to check against the property

    QueryableFilter(String, String, SQLOperator)

    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)
    Parameters
    Type Name Description
    System.String propName

    The first property to compare

    System.String propName2

    The second property to compare

    SQLOperator op

    The operator to use for the comparison

    Properties

    ComparrisonPropertyName

    The property to compare the PropertyName to using the Op operator

    Declaration
    public string ComparrisonPropertyName { get; set; }
    Property Value
    Type Description
    System.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
    System.Nullable<GroupType>

    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
    System.String

    Type

    The type of the property this filter is comparing

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

    Value

    The value to compare the PropertyName to using the Op operator

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

    ValueIsOtherProperty

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

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

    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
    System.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
    System.Func<System.String, System.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

    System.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
    System.Type forType

    The type of item this where clause would be operating against

    System.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>(Boolean)

    Converts this QueryableFilter into a System.Linq.Expressions.Expression<TDelegate> of System.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
    System.Boolean oDataQuery

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

    Returns
    Type Description
    System.Linq.Expressions.Expression<System.Func<T, System.Boolean>>

    A System.Linq.Expressions.Expression<TDelegate> of System.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
    System.String

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

    Overrides
    System.Object.ToString()

    Explicit Interface Implementations

    ICloneable.Clone()

    Implementation of 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
    object ICloneable.Clone()
    Returns
    Type Description
    System.Object

    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

    Implements

    IHasChildren<T>
    IHasChildren
    ICloneable
    ICloneable<T>

    Extension Methods

    HasChildrenExtensions.HasChildren(IHasChildren)
    HasChildrenExtensions.GetAllChildren(IHasChildren)
    HasChildrenExtensions.GetRootParent(IHasChildren)
    HasChildrenExtensions.GetLeafChildNodesOnly(IHasChildren)
    HasChildrenExtensions.GetAllChildren<T>(IHasChildren<T>)
    HasChildrenExtensions.GetRootParent<T>(T)
    HasChildrenExtensions.GetLeafChildNodesOnly<T>(T)
    HasChildrenExtensions.ContainsMatchingNode<T>(T, Func<T, Boolean>)
    HasChildrenExtensions.GetMatchingNode<T>(T, Func<T, Boolean>)
    HasChildrenExtensions.MaxTreeDepth(IHasChildren)
    HasChildrenExtensions.GetRootToNode<T>(T)
    HasChildrenExtensions.GetPath<T>(T, String, Func<T, String>)
    MiscExtensions.SetIfNotEqual<T, P>(T, Expression<Func<T, P>>, P)
    ReflectionExtensions.ClearEventInvocations(Object, String)
    StringExtensions.ToCSVFormatString(Object, Type)
    SQLExtensions.ToSQLValue(Object, Boolean)

    See Also

    QueryableExecuter
    QueryableExecuter<T>
    QueryableExecuter<T, TT>
    In This Article
    Back to top © LemonTree Software Ltd. All rights reserved.