Path: redb/redb.Core/Providers/IListProvider.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/IListProvider.cs
----
using redb.Core.Models.Contracts;
using redb.Core.Models.Entities;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace redb.Core.Providers
{
///
/// Provider for working with dictionaries (Lists) and their items (ListItems).
///
public interface IListProvider
{
///
/// Resolves many linked objects in one round-trip on the owning service's connection, for the hand-out preload
/// (PreloadListItemLinkedObjects). Returns only the objects that exist; a missing id simply stays lazy on
/// its item. Set by the owning . A single loads on the
/// live scope of whoever reads it - the provider attaches no loader to items (owner decision 2026-09-15).
///
Func, CancellationToken, Task>>? LinkedObjectsBatchLoader { get => null; set { } }
// === LIST CRUD ===
Task GetListAsync(long listId,
CancellationToken cancellationToken = default);
Task GetListByNameAsync(string name,
CancellationToken cancellationToken = default);
Task> GetAllListsAsync(CancellationToken cancellationToken = default);
///
/// Get list with all its items loaded.
///
Task GetListWithItemsAsync(long listId,
CancellationToken cancellationToken = default);
///
/// Get list by name with all its items loaded.
///
Task GetListByNameWithItemsAsync(string name,
CancellationToken cancellationToken = default);
Task SaveListAsync(IRedbList list,
CancellationToken cancellationToken = default);
Task DeleteListAsync(long listId,
CancellationToken cancellationToken = default);
// === ITEM CRUD ===
Task GetListItemAsync(long itemId,
CancellationToken cancellationToken = default);
///
/// The list items of the given ids, in one query for those the cache does not hold. An id that names no item is
/// absent from the result; the order of the result is not that of the ids.
///
Task> GetListItemsByIdsAsync(IEnumerable itemIds,
CancellationToken cancellationToken = default);
Task> GetListItemsAsync(long listId,
CancellationToken cancellationToken = default);
Task GetListItemByValueAsync(long listId, string value,
CancellationToken cancellationToken = default);
Task SaveListItemAsync(IRedbListItem item,
CancellationToken cancellationToken = default);
Task DeleteListItemAsync(long itemId,
CancellationToken cancellationToken = default);
///
/// Add multiple items from ready objects.
///
Task> AddItemsAsync(IRedbList list, IEnumerable items,
CancellationToken cancellationToken = default);
///
/// Add multiple items from string values (convenience method).
///
Task> AddItemsAsync(IRedbList list, IEnumerable values, IEnumerable? aliases = null,
CancellationToken cancellationToken = default);
///
/// Save list with all its items (Aggregate Root).
///
Task SaveListWithItemsAsync(IRedbList list,
CancellationToken cancellationToken = default);
// === SPECIFIC METHODS ===
Task> GetItemsByObjectReferenceAsync(long objectId,
CancellationToken cancellationToken = default);
Task IsListUsedInStructuresAsync(long listId,
CancellationToken cancellationToken = default);
Task SyncListFromEnumAsync(string? listName = null,
CancellationToken cancellationToken = default) where TEnum : struct, Enum;
}
}