Class MetadataQueryBuilder
Allows building a fluent query to the metadata repository.
Inherited Members
Namespace: Unity.Cloud.Metadata
Assembly: solution.dll
Syntax
public class MetadataQueryBuilder
Methods
ExecuteAsync(CancellationToken)
Executes the built query by calling the metadata repository.
Declaration
public Task<MatchCollection> ExecuteAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | The cancellation token |
Returns
| Type | Description |
|---|---|
| Task<MatchCollection> | The list of Match |
IncludedIn(params InstanceId[])
Adds the owner IDs to the lookup query.
Declaration
public MetadataQueryBuilder IncludedIn(params InstanceId[] instanceIds)
Parameters
| Type | Name | Description |
|---|---|---|
| InstanceId[] | instanceIds | The owners' ids |
Returns
| Type | Description |
|---|---|
| MetadataQueryBuilder | The called MetadataQueryBuilder |
LimitTo(int)
Specify the number of metadata record to return. Useful when the dataset contains thousands of metadata entry, which can affect performance.
Declaration
public MetadataQueryBuilder LimitTo(int amount)
Parameters
| Type | Name | Description |
|---|---|---|
| int | amount | The number of metadata record to return |
Returns
| Type | Description |
|---|---|
| MetadataQueryBuilder | The called MetadataQueryBuilder |
Select(params string[])
Adds the desired output metadata keys to the query.
Declaration
public MetadataQueryBuilder Select(params string[] keys)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | keys | An array of wanted keys |
Returns
| Type | Description |
|---|---|
| MetadataQueryBuilder | The called MetadataQueryBuilder |
SelectAll()
Sets the query to return the full metadata.
Declaration
public MetadataQueryBuilder SelectAll()
Returns
| Type | Description |
|---|---|
| MetadataQueryBuilder | The called MetadataQueryBuilder |
SelectOnlyId()
Sets the query to only return the owner ID.
Declaration
public MetadataQueryBuilder SelectOnlyId()
Returns
| Type | Description |
|---|---|
| MetadataQueryBuilder | The called MetadataQueryBuilder |
WhereKeyEquals(IEnumerable<string>, string)
Adds metadata conditions to the query.
Declaration
public MetadataQueryBuilder WhereKeyEquals(IEnumerable<string> path, string value)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<string> | path | A list representing the path of keys and sub-keys in the metadata |
| string | value | The value that the last keys in the keyHierarchy needs to be equals to |
Returns
| Type | Description |
|---|---|
| MetadataQueryBuilder | The called MetadataQueryBuilder |