Table of Contents

Class ConnectorRegistry

Namespace
JD.AI.Connectors.Sdk
Assembly
JD.AI.Connectors.Sdk.dll

Discovers, registers, and manages IConnector implementations.

public sealed class ConnectorRegistry
Inheritance
ConnectorRegistry
Inherited Members

Properties

All

All registered connectors.

public IReadOnlyCollection<ConnectorDescriptor> All { get; }

Property Value

IReadOnlyCollection<ConnectorDescriptor>

Methods

Get(string)

Gets a registered connector by name.

public ConnectorDescriptor? Get(string name)

Parameters

name string

Returns

ConnectorDescriptor

Register(IConnector, IServiceCollection)

Registers a connector and runs its Configure(IConnectorBuilder) method.

public ConnectorDescriptor Register(IConnector connector, IServiceCollection services)

Parameters

connector IConnector

The connector instance.

services IServiceCollection

The service collection to configure.

Returns

ConnectorDescriptor

Exceptions

InvalidOperationException

Thrown if the connector is not decorated with JdAiConnectorAttribute.

ScanAndRegister(IEnumerable<Assembly>, IServiceCollection)

Scans assemblies for types with JdAiConnectorAttribute and registers each found connector using a default (parameterless) constructor.

public void ScanAndRegister(IEnumerable<Assembly> assemblies, IServiceCollection services)

Parameters

assemblies IEnumerable<Assembly>

Assemblies to scan.

services IServiceCollection

The service collection.

SetEnabled(string, bool)

Enables or disables a registered connector by name.

public bool SetEnabled(string name, bool enabled)

Parameters

name string
enabled bool

Returns

bool

true if the connector was found and updated.