Show / Hide Table of Contents

Delegate DtmiResolverAsync

The DtmiResolverAsync delegate enables a client of the parser to set a callback that will be invoked when the parser encounters a context reference or a dependent reference to a DTMI for which it has no definition. This callback will be called during execution of the ParseAsync(IAsyncEnumerable<string>, DtdlParseLocator, CancellationToken) API. The resolver accepts a collection of DTMIs as an argument, so a batch of identifiers can be resolved together; this reduces the count of network round trips when resolution requires remote retrieval. If the resolver is unable to obtain a definition for the DTMIs, it should return null for the enumeration.

Namespace: DTDLParser
Assembly: DTDLParser.dll
Syntax
public delegate IAsyncEnumerable<string> DtmiResolverAsync(IReadOnlyCollection<Dtmi> dtmis, CancellationToken cancellationToken = default)
Parameters
Type Name Description
IReadOnlyCollection<Dtmi> dtmis

A collection of DTMIs to resolve.

CancellationToken cancellationToken

A CancellationToken to cancel the resolution prematurely.

Returns
Type Description
IAsyncEnumerable<string>

An enumeration of JSON strings that collectively include definitions for all elements with the given DTMIs. The order is not required to match the order of the DTMIs passed to the resolver.

  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX