Method TryAddVariantAsync
TryAddVariantAsync(FileId, string, IFileProcessingPipelineSelector, CancellationToken)
Tries to add a new file variant (and any nested auto-variants declared by the pipeline) to an existing file in the repository.
Declaration
public TaskWithProgress<IReadOnlyList<RepoFileInfo>?> TryAddVariantAsync(FileId fileId, string variantId, IFileProcessingPipelineSelector pipeline, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| FileId | fileId | |
| string | variantId | |
| IFileProcessingPipelineSelector | pipeline | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| TaskWithProgress<IReadOnlyList<RepoFileInfo>> | The stored variants, or null if any declared variant ID in the tree already exists or if any per-variant lock cannot be acquired immediately. |
Remarks
The operation is strict and all-or-nothing: any collision aborts the entire add.
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | The repository was opened read-only. |
TryAddVariantAsync(FileId, string, string?, IFileProcessingPipelineSelector, CancellationToken)
Tries to add a new file variant (and any nested auto-variants declared by the pipeline) to an existing file in the repository.
Declaration
public TaskWithProgress<IReadOnlyList<RepoFileInfo>?> TryAddVariantAsync(FileId fileId, string variantId, string? sourceVariantId, IFileProcessingPipelineSelector pipeline, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| FileId | fileId | |
| string | variantId | |
| string | sourceVariantId | |
| IFileProcessingPipelineSelector | pipeline | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| TaskWithProgress<IReadOnlyList<RepoFileInfo>> | The stored variants, or null if any declared variant ID in the tree already exists or if any per-variant lock cannot be acquired immediately. |
Remarks
The operation is strict and all-or-nothing: any collision aborts the entire add.
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | The repository was opened read-only. |