Class TemplateConnectionResolver

Namespace
Cratis.Arc.Connections
Assembly
Cratis.Arc.Core.dll

Represents an IConnectionResolver that resolves from templates with placeholders.

[IgnoreConvention]
public class TemplateConnectionResolver : IConnectionResolver
Inheritance
TemplateConnectionResolver
Implements
Inherited Members
Extension Methods

Remarks

Placeholders are written in braces and are matched against the scope of the request without regard to case, for instance Server=sql.example;Database=app-{tenant}. The placeholders {purpose} and {storage} are always available. A placeholder without a value fails rather than producing a connection to the wrong database.

Constructors

TemplateConnectionResolver(TemplateConnectionResolverOptions)

Represents an IConnectionResolver that resolves from templates with placeholders.

public TemplateConnectionResolver(TemplateConnectionResolverOptions options)

Parameters

options TemplateConnectionResolverOptions

The TemplateConnectionResolverOptions.

Remarks

Placeholders are written in braces and are matched against the scope of the request without regard to case, for instance Server=sql.example;Database=app-{tenant}. The placeholders {purpose} and {storage} are always available. A placeholder without a value fails rather than producing a connection to the wrong database.

Methods

Resolve(ConnectionRequest, CancellationToken)

Resolve a connection.

public Task<ResolvedConnection> Resolve(ConnectionRequest request, CancellationToken cancellationToken = default)

Parameters

request ConnectionRequest

The ConnectionRequest to resolve for.

cancellationToken CancellationToken

Optional CancellationToken.

Returns

Task<ResolvedConnection>

The ResolvedConnection. Use Unchanged to keep the configured connection.