Search Results for

    Show / Hide Table of Contents

    Class QueryExecuterHelper

    A helper class for common functions using QueryableExecuters

    Inheritance
    object
    QueryExecuterHelper
    Inherited Members
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: LemonEdge.Utils
    Assembly: LemonEdge.Utils.dll
    Syntax
    public static class QueryExecuterHelper

    Methods

    FilterItems<T>(IEnumerable<T>, QueryableFilter)

    Applies a QueryableFilter to a collection of items

    Declaration
    public static IEnumerable<T> FilterItems<T>(this IEnumerable<T> items, QueryableFilter filter)
    Parameters
    Type Name Description
    IEnumerable<T> items

    The collection of items to apply a filter to

    QueryableFilter filter

    The filter to apply to a collection of items

    Returns
    Type Description
    IEnumerable<T>

    Only the items that match the specified filter

    Type Parameters
    Name Description
    T

    The type of items in the collection

    MergeQueryResults<T>(QueryableExecuter, (List<T> NewItems, List<T> UpdatedItems, List<T> DeletedItems), IQueryable, IEnumerable<T>, IEqualityComparer<T>)

    Merges a set of results from a QueryableExecuter with the local new, updated and deleted items. Takes account of any paging state on the items too

    Declaration
    public static IEnumerable<T> MergeQueryResults<T>(this QueryableExecuter items, (List<T> NewItems, List<T> UpdatedItems, List<T> DeletedItems) localItems, IQueryable localMergedItems, IEnumerable<T> externalResults, IEqualityComparer<T> comparer)
    Parameters
    Type Name Description
    QueryableExecuter items

    The QueryableExecuter that holds all the filtering information that was applied to the external result set

    (List<T> NewItems, List<T> UpdatedItems, List<T> DeletedItems) localItems

    All the New, Updated, and Deleted items held locally of the same type

    IQueryable localMergedItems

    The new and Updated items merged together with the QueryableExecuter filtering applied

    IEnumerable<T> externalResults

    The set of data returned from executing the QueryableExecuter against the database

    IEqualityComparer<T> comparer

    A comparer to ensure duplicate items are eliminated. i.e. if the external results contains an item that is modified locally we want to keep the local modified version

    Returns
    Type Description
    IEnumerable<T>

    The external result items merged with the local items according to any paging requirements of the QueryableExecuter

    Type Parameters
    Name Description
    T

    The type of items being merged

    ToSingleFilter(IEnumerable<QueryableFilter>, GroupType)

    Takes a collection of filters and creates a new one with the specified groupBy logical operator applied to the collection of filters as children

    Declaration
    public static QueryableFilter ToSingleFilter(this IEnumerable<QueryableFilter> filters, GroupType groupBy)
    Parameters
    Type Name Description
    IEnumerable<QueryableFilter> filters

    The set of filters to be child filters for the newly created QueryableFilter

    GroupType groupBy

    The logical operator to apply to all the child filters

    Returns
    Type Description
    QueryableFilter

    A new QueryableFilter with the specified filters as children

    Remarks

    For instance takes the filters (XXX Equals 123), (YYY NotEquals 456) and when applied with the operator OR returns ((XXX Equals 123) OR (YYY NotEquals 456))

    In this article
    Back to top © LemonEdge Technologies. All rights reserved.