Method GetOrAddVariantAsync
GetOrAddVariantAsync(FileId, string, IFileProcessingPipelineSelector, CancellationToken)
Adds new file variants where they do not already exist, processing missing variants through their pipelines and keeping existing ones unchanged. Each declared variant ID in the tree is represented in the returned list; variants whose pipelines stored an alias due to AliasWhenVariantSourceUnchanged resolve transparently to their source.
Declaration
public TaskWithProgress<IReadOnlyList<RepoFileInfo>> GetOrAddVariantAsync(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>> |
Remarks
Variants whose pipelines opt into AliasWhenVariantSourceUnchanged remain addressable after the add: an alias marker is stored that transparently resolves to the variant's source on fetch operations. Nested variants of the aliased variant still run against the unchanged parent source.
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | The repository was opened read-only and a variant in the requested tree would have to be added. |
GetOrAddVariantAsync(FileId, string, string?, IFileProcessingPipelineSelector, CancellationToken)
Adds new file variants where they do not already exist, processing missing variants through their pipelines and keeping existing ones unchanged. Each declared variant ID in the tree is represented in the returned list; variants whose pipelines stored an alias due to AliasWhenVariantSourceUnchanged resolve transparently to their source.
Declaration
public TaskWithProgress<IReadOnlyList<RepoFileInfo>> GetOrAddVariantAsync(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>> |
Remarks
Variants whose pipelines opt into AliasWhenVariantSourceUnchanged remain addressable after the add: an alias marker is stored that transparently resolves to the variant's source on fetch operations. Nested variants of the aliased variant still run against the unchanged parent source.
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | The repository was opened read-only and a variant in the requested tree would have to be added. |