Path: redb/redb.Core/Providers/IQueryProvider.cs
Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb
Page: https://redbase.app/src/dev-2026-12-06/redb/redb.Core/Providers/IQueryProvider.cs
----
using redb.Core.Query;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using redb.Core.Models.Contracts;
namespace redb.Core.Providers
{
///
/// Provider for creating LINQ queries (high-level API).
///
public interface IQueryableProvider
{
///
/// Create type-safe query by type (synchronous).
///
IRedbQueryable Query() where TProps : class, new();
///
/// Create type-safe query by type with specified user (synchronous).
///
IRedbQueryable Query(IRedbUser user) where TProps : class, new();
// ===== TREE LINQ QUERIES =====
///
/// Create type-safe tree query by type (synchronous).
/// Supports hierarchical operators: WhereHasAncestor, WhereHasDescendant, WhereLevel, WhereRoots, WhereLeaves.
///
IRedbQueryable TreeQuery() where TProps : class, new();
///
/// Create type-safe tree query by type with specified user (synchronous).
/// Supports hierarchical operators: WhereHasAncestor, WhereHasDescendant, WhereLevel, WhereRoots, WhereLeaves.
///
IRedbQueryable TreeQuery(IRedbUser user) where TProps : class, new();
// ===== TREE LINQ WITH SUBTREE LIMITATION =====
// ===== SYNCHRONOUS VERSIONS =====
///
/// Create tree query limited to subtree (synchronous, by ID).
/// Search will be performed only among descendants of specified rootObjectId.
///
IRedbQueryable TreeQuery(long rootObjectId, int? maxDepth = null) where TProps : class, new();
///
/// Create tree query limited to subtree (synchronous).
/// If rootObject = null, returns empty queryable (more convenient for client code).
///
IRedbQueryable TreeQuery(IRedbObject? rootObject, int? maxDepth = null) where TProps : class, new();
///
/// Create tree query limited to subtrees of object list (synchronous).
/// If list empty, returns empty queryable (more convenient for client code).
///
IRedbQueryable TreeQuery(IEnumerable rootObjects, int? maxDepth = null) where TProps : class, new();
///
/// Create tree query limited to subtrees by ID list (synchronous).
/// If list empty, returns empty queryable.
///
IRedbQueryable TreeQuery(IEnumerable rootObjectIds, int? maxDepth = null) where TProps : class, new();
///
/// Create tree query limited to subtree with specified user (synchronous, by ID).
/// Search will be performed only among descendants of specified rootObjectId.
///
IRedbQueryable TreeQuery(long rootObjectId, IRedbUser user, int? maxDepth = null) where TProps : class, new();
///
/// Create tree query limited to subtree with specified user (synchronous).
/// If rootObject = null, returns empty queryable (more convenient for client code).
///
IRedbQueryable TreeQuery(IRedbObject? rootObject, IRedbUser user, int? maxDepth = null) where TProps : class, new();
///
/// Create tree query limited to subtrees of object list with specified user (synchronous).
/// If list empty, returns empty queryable (more convenient for client code).
///
IRedbQueryable TreeQuery(IEnumerable rootObjects, IRedbUser user, int? maxDepth = null) where TProps : class, new();
///
/// Create tree query limited to subtrees by ID list with specified user (synchronous).
/// If list empty, returns empty queryable.
///
IRedbQueryable TreeQuery(IEnumerable rootObjectIds, IRedbUser user, int? maxDepth = null) where TProps : class, new();
}
}