Class ConnectorFactory<TOptions, TConnection>
Provides access to connectors, whose connection strings originate from merging appsettings.json with cloud service bindings.
Inheritance
System.Object
ConnectorFactory<TOptions, TConnection>
Namespace: Steeltoe.Connectors
Assembly: Steeltoe.Connectors.dll
Syntax
public sealed class ConnectorFactory<TOptions, TConnection> : IDisposable where TOptions : ConnectionStringOptions where TConnection : class
Type Parameters
Name | Description |
---|---|
TOptions | The options type, which provides the connection string. |
TConnection | The driver-specific connection type. |
Constructors
| Edit this page View SourceConnectorFactory(IServiceProvider, IReadOnlySet<String>, ConnectorCreateConnection, Boolean)
Declaration
public ConnectorFactory(IServiceProvider serviceProvider, IReadOnlySet<string> serviceBindingNames, ConnectorCreateConnection createConnection, bool useSingletonConnection)
Parameters
Type | Name | Description |
---|---|---|
IServiceProvider | serviceProvider | |
IReadOnlySet<System.String> | serviceBindingNames | |
ConnectorCreateConnection | createConnection | |
System.Boolean | useSingletonConnection |
Properties
| Edit this page View SourceServiceBindingNames
Gets the names of the available service bindings.
Declaration
public IReadOnlySet<string> ServiceBindingNames { get; }
Property Value
Type | Description |
---|---|
IReadOnlySet<System.String> | The service binding names. An empty string represents the default service binding. |
Methods
| Edit this page View SourceDispose()
Declaration
public void Dispose()
Get()
Gets a connector for the default service binding.
Declaration
public Connector<TOptions, TConnection> Get()
Returns
Type | Description |
---|---|
Connector<TOptions, TConnection> | The connector. |
Remarks
This is only available when at most one named service binding exists in the cloud and the client configuration only contains the "Default" entry.
Get(String)
Gets a connector for the specified service binding name.
Declaration
public Connector<TOptions, TConnection> Get(string serviceBindingName)
Parameters
Type | Name | Description |
---|---|---|
System.String | serviceBindingName | The case-sensitive service binding name. |
Returns
Type | Description |
---|---|
Connector<TOptions, TConnection> | The connector. |