Path: redb/redb.Core/Data/IBulkOperations.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/Data/IBulkOperations.cs
----
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using redb.Core.Models.Entities;
namespace redb.Core.Data
{
///
/// Bulk operations abstraction for high-performance data operations.
/// Replaces EFCore.BulkExtensions with pure ADO.NET COPY protocol.
///
public interface IBulkOperations
{
///
/// Bulk insert objects using COPY protocol.
/// Much faster than individual INSERTs for large datasets.
///
/// Objects to insert.
/// Cancels the operation; see the cancellation contract in the plan (OCE only, rollback always completes).
Task BulkInsertObjectsAsync(IEnumerable objects, CancellationToken cancellationToken = default);
///
/// Bulk insert values using COPY protocol.
///
/// Values to insert.
/// Cancels the operation; see the cancellation contract in the plan (OCE only, rollback always completes).
Task BulkInsertValuesAsync(IEnumerable values, CancellationToken cancellationToken = default);
///
/// Bulk update objects.
/// Uses temp table + UPDATE FROM pattern for efficiency.
///
/// Objects to update.
/// Cancels the operation; see the cancellation contract in the plan (OCE only, rollback always completes).
Task BulkUpdateObjectsAsync(IEnumerable objects, CancellationToken cancellationToken = default);
///
/// Bulk update values.
/// Uses temp table + UPDATE FROM pattern for efficiency.
///
/// Values to update.
/// Cancels the operation; see the cancellation contract in the plan (OCE only, rollback always completes).
Task BulkUpdateValuesAsync(IEnumerable values, CancellationToken cancellationToken = default);
///
/// Bulk delete objects by IDs.
/// Uses ANY() with array for efficiency.
///
/// Object IDs to delete.
/// Cancels the operation; see the cancellation contract in the plan (OCE only, rollback always completes).
Task BulkDeleteObjectsAsync(IEnumerable objectIds, CancellationToken cancellationToken = default);
///
/// Bulk delete values by IDs.
///
/// Value IDs to delete.
/// Cancels the operation; see the cancellation contract in the plan (OCE only, rollback always completes).
Task BulkDeleteValuesAsync(IEnumerable valueIds, CancellationToken cancellationToken = default);
///
/// Bulk delete values by object IDs.
/// Commonly used before re-inserting all values for object.
///
/// Object IDs whose values to delete.
/// Cancels the operation; see the cancellation contract in the plan (OCE only, rollback always completes).
Task BulkDeleteValuesByObjectIdsAsync(IEnumerable objectIds, CancellationToken cancellationToken = default);
///
/// Bulk delete values by ListItem IDs.
/// Used when deleting list items that are referenced by values.
///
/// ListItem IDs whose referencing values to delete.
/// Cancels the operation; see the cancellation contract in the plan (OCE only, rollback always completes).
Task BulkDeleteValuesByListItemIdsAsync(IEnumerable listItemIds, CancellationToken cancellationToken = default);
}
}