Interface IRedbQueryable<TProps>
Main interface for type-safe LINQ queries to REDB.
public interface IRedbQueryable<TProps> where TProps : class, new()
Methods
AggregateAsync<TResult>(Expression<Func<RedbObject<TProps>, TResult>>)
Flexible aggregation - choose what to aggregate via Agg.Sum/Avg/Min/Max/Count.
Task<TResult> AggregateAsync<TResult>(Expression<Func<RedbObject<TProps>, TResult>> selector)
AggregateRedbAsync<TResult>(Expression<Func<IRedbObject, TResult>>)
Flexible aggregation for IRedbObject base fields ONLY.
Task<TResult> AggregateRedbAsync<TResult>(Expression<Func<IRedbObject, TResult>> selector)
AllAsync(Expression<Func<TProps, bool>>)
Check if ALL records match condition.
Task<bool> AllAsync(Expression<Func<TProps, bool>> predicate)
AnyAsync(Expression<Func<TProps, bool>>)
Check if any records match condition.
Task<bool> AnyAsync(Expression<Func<TProps, bool>> predicate)
AverageAsync<TField>(Expression<Func<TProps, TField>>)
Average of field values.
Task<decimal> AverageAsync<TField>(Expression<Func<TProps, TField>> selector) where TField : struct
AverageRedbAsync<TField>(Expression<Func<IRedbObject, TField>>)
Average of IRedbObject base field values.
Task<decimal> AverageRedbAsync<TField>(Expression<Func<IRedbObject, TField>> selector) where TField : struct
DistinctBy<TKey>(Expression<Func<TProps, TKey>>)
DISTINCT ON (field) - one object per unique Props field value.
IRedbQueryable<TProps> DistinctBy<TKey>(Expression<Func<TProps, TKey>> keySelector)
DistinctByRedb<TKey>(Expression<Func<IRedbObject, TKey>>)
DISTINCT ON (base_field) - one object per unique IRedbObject base field value.
IRedbQueryable<TProps> DistinctByRedb<TKey>(Expression<Func<IRedbObject, TKey>> keySelector)
DistinctRedb()
DISTINCT by IRedbObject base fields (Name, ValueLong, ParentId, etc.) excluding Id.
IRedbQueryable<TProps> DistinctRedb()
FirstOrDefaultAsync(Expression<Func<TProps, bool>>)
Get first object matching condition, or null.
Task<RedbObject<TProps>?> FirstOrDefaultAsync(Expression<Func<TProps, bool>> predicate)
GetStatisticsAsync<TField>(Expression<Func<TProps, TField>>)
Get field statistics (Sum, Avg, Min, Max, Count) in single call.
Task<FieldStatistics<TField>> GetStatisticsAsync<TField>(Expression<Func<TProps, TField>> selector) where TField : struct
GroupBy<TKey>(Expression<Func<TProps, TKey>>)
Group by field with subsequent aggregation.
IRedbGroupedQueryable<TKey, TProps> GroupBy<TKey>(Expression<Func<TProps, TKey>> keySelector)
GroupByArray<TItem, TKey>(Expression<Func<TProps, IEnumerable<TItem>>>, Expression<Func<TItem, TKey>>)
Group by array elements (Items[].Property).
IRedbGroupedQueryable<TKey, TItem> GroupByArray<TItem, TKey>(Expression<Func<TProps, IEnumerable<TItem>>> arraySelector, Expression<Func<TItem, TKey>> keySelector) where TItem : class, new()
GroupByRedb<TKey>(Expression<Func<IRedbObject, TKey>>)
Group by IRedbObject base fields (id, scheme_id, parent_id, etc.).
IRedbGroupedQueryable<TKey, TProps> GroupByRedb<TKey>(Expression<Func<IRedbObject, TKey>> keySelector)
MaxAsync<TField>(Expression<Func<TProps, TField>>)
Maximum field value.
Task<TField?> MaxAsync<TField>(Expression<Func<TProps, TField>> selector) where TField : struct
MaxRedbAsync<TField>(Expression<Func<IRedbObject, TField>>)
Maximum IRedbObject base field value (ValueLong, Key, DateCreate, etc.).
Task<TField?> MaxRedbAsync<TField>(Expression<Func<IRedbObject, TField>> selector) where TField : struct
MinAsync<TField>(Expression<Func<TProps, TField>>)
Minimum field value.
Task<TField?> MinAsync<TField>(Expression<Func<TProps, TField>> selector) where TField : struct
MinRedbAsync<TField>(Expression<Func<IRedbObject, TField>>)
Minimum IRedbObject base field value (ValueLong, Key, DateCreate, etc.).
Task<TField?> MinRedbAsync<TField>(Expression<Func<IRedbObject, TField>> selector) where TField : struct
OrderBy<TKey>(Expression<Func<TProps, TKey>>)
Sort ascending by Props field.
IOrderedRedbQueryable<TProps> OrderBy<TKey>(Expression<Func<TProps, TKey>> keySelector)
OrderByDescending<TKey>(Expression<Func<TProps, TKey>>)
Sort descending by Props field.
IOrderedRedbQueryable<TProps> OrderByDescending<TKey>(Expression<Func<TProps, TKey>> keySelector)
OrderByDescendingRedb<TKey>(Expression<Func<IRedbObject, TKey>>)
Sort descending by IRedbObject base fields.
IOrderedRedbQueryable<TProps> OrderByDescendingRedb<TKey>(Expression<Func<IRedbObject, TKey>> keySelector)
OrderByRedb<TKey>(Expression<Func<IRedbObject, TKey>>)
Sort ascending by IRedbObject base fields (id, name, date_create, etc.).
IOrderedRedbQueryable<TProps> OrderByRedb<TKey>(Expression<Func<IRedbObject, TKey>> keySelector)
Select<TResult>(Expression<Func<RedbObject<TProps>, TResult>>)
Project fields - return only selected properties.
IRedbProjectedQueryable<TResult> Select<TResult>(Expression<Func<RedbObject<TProps>, TResult>> selector)
SumAsync<TField>(Expression<Func<TProps, TField>>)
Sum of field values.
Task<decimal> SumAsync<TField>(Expression<Func<TProps, TField>> selector) where TField : struct
SumRedbAsync<TField>(Expression<Func<IRedbObject, TField>>)
Sum of IRedbObject base field values (ValueLong, Key, etc.).
Task<decimal> SumRedbAsync<TField>(Expression<Func<IRedbObject, TField>> selector) where TField : struct
ToFilterJsonAsync()
Get JSON filter that will be sent to SQL function (for diagnostics).
Task<string> ToFilterJsonAsync()
ToFlatListAsync()
Execute query and get flat list of tree objects.
Task<List<TreeRedbObject<TProps>>> ToFlatListAsync()
ToRootListAsync()
Execute query and get list of root tree nodes.
Task<List<ITreeRedbObject>> ToRootListAsync()
ToTreeListAsync()
Execute query and return filtered objects with populated Parent/Children chains.
Task<List<TreeRedbObject<TProps>>> ToTreeListAsync()
Where(Expression<Func<TProps, bool>>)
Filter by Props fields.
IRedbQueryable<TProps> Where(Expression<Func<TProps, bool>> predicate)
WhereChildrenOf(IRedbObject)
Direct children of specified object.
IRedbQueryable<TProps> WhereChildrenOf(IRedbObject parentObject)
WhereChildrenOf(long)
Direct children of specified object.
IRedbQueryable<TProps> WhereChildrenOf(long parentId)
WhereDescendantsOf(IRedbObject, int?)
All descendants of specified object (recursive).
IRedbQueryable<TProps> WhereDescendantsOf(IRedbObject ancestorObject, int? maxDepth = null)
WhereDescendantsOf(long, int?)
All descendants of specified object (recursive).
IRedbQueryable<TProps> WhereDescendantsOf(long ancestorId, int? maxDepth = null)
WhereHasAncestor<TTarget>(Expression<Func<TTarget, bool>>, int?)
Filter by ancestors: find objects that have an ancestor of specified type matching condition.
IRedbQueryable<TProps> WhereHasAncestor<TTarget>(Expression<Func<TTarget, bool>> ancestorCondition, int? maxDepth = null) where TTarget : class
WhereHasDescendant<TTarget>(Expression<Func<TTarget, bool>>, int?)
Filter by descendants: find objects that have a descendant of specified type matching condition.
IRedbQueryable<TProps> WhereHasDescendant<TTarget>(Expression<Func<TTarget, bool>> descendantCondition, int? maxDepth = null) where TTarget : class
WhereIn<TValue>(Expression<Func<TProps, TValue>>, IEnumerable<TValue>)
Filter by value in list (WHERE field IN (...)).
IRedbQueryable<TProps> WhereIn<TValue>(Expression<Func<TProps, TValue>> selector, IEnumerable<TValue> values)
WhereInRedb<TValue>(Expression<Func<IRedbObject, TValue>>, IEnumerable<TValue>)
Filter by IRedbObject base field in list (WHERE _field IN (...)).
IRedbQueryable<TProps> WhereInRedb<TValue>(Expression<Func<IRedbObject, TValue>> selector, IEnumerable<TValue> values)
WhereLevel(Expression<Func<int, bool>>)
Filter by tree level with comparison operator.
IRedbQueryable<TProps> WhereLevel(Expression<Func<int, bool>> levelCondition)
WhereRedb(Expression<Func<IRedbObject, bool>>)
Filter by base object fields (Id, Name, ParentId, etc.).
IRedbQueryable<TProps> WhereRedb(Expression<Func<IRedbObject, bool>> predicate)
WithLazyLoading(bool)
Enable/disable lazy loading of Props for this query.
IRedbQueryable<TProps> WithLazyLoading(bool enabled = true)
WithMaxRecursionDepth(int)
Configure maximum recursion depth for complex queries ($and/$or/$not).
IRedbQueryable<TProps> WithMaxRecursionDepth(int depth)
WithPropsDepth(int)
Configure maximum depth for loading nested RedbObject in Props.
IRedbQueryable<TProps> WithPropsDepth(int depth)
WithWindow(Action<IWindowSpec<TProps>>)
Query with window functions.
IRedbWindowedQueryable<TProps> WithWindow(Action<IWindowSpec<TProps>> windowConfig)