Class QueryExecuterHelper
A helper class for common functions using QueryableExecuters
Inheritance
Inherited Members
Namespace: LemonEdge.Utils
Assembly: 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 |
---|---|---|
System.Collections.Generic.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 |
---|---|
System.Collections.Generic.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 |
System.ValueTuple<System.Collections.Generic.List<T>, System.Collections.Generic.List<T>, System.Collections.Generic.List<T>> | localItems | All the New, Updated, and Deleted items held locally of the same type |
System.Linq.IQueryable | localMergedItems | The new and Updated items merged together with the QueryableExecuter filtering applied |
System.Collections.Generic.IEnumerable<T> | externalResults | The set of data returned from executing the QueryableExecuter against the database |
System.Collections.Generic.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 |
---|---|
System.Collections.Generic.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 |
---|---|---|
System.Collections.Generic.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))