Class ConnectorFactory<TOptions, TConnection>
- Namespace
- Steeltoe.Connectors
- Assembly
- Steeltoe.Connectors.dll
Provides access to connectors, whose connection strings originate from merging appsettings.json with cloud service bindings.
public sealed class ConnectorFactory<TOptions, TConnection> : IDisposable where TOptions : ConnectionStringOptions where TConnection : class
Type Parameters
TOptions
The options type, which provides the connection string.
TConnection
The driver-specific connection type.
- Inheritance
-
ConnectorFactory<TOptions, TConnection>
- Implements
- Inherited Members
Constructors
ConnectorFactory(IServiceProvider, IReadOnlySet<string>, ConnectorCreateConnection, bool)
public ConnectorFactory(IServiceProvider serviceProvider, IReadOnlySet<string> serviceBindingNames, ConnectorCreateConnection createConnection, bool useSingletonConnection)
Parameters
serviceProvider
IServiceProviderserviceBindingNames
IReadOnlySet<string>createConnection
ConnectorCreateConnectionuseSingletonConnection
bool
Properties
ServiceBindingNames
Gets the names of the available service bindings.
public IReadOnlySet<string> ServiceBindingNames { get; }
Property Value
- IReadOnlySet<string>
The service binding names. An empty string represents the default service binding.
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Get()
Gets a connector for the default service binding.
public Connector<TOptions, TConnection> Get()
Returns
- 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.
public Connector<TOptions, TConnection> Get(string serviceBindingName)
Parameters
serviceBindingName
stringThe case-sensitive service binding name.
Returns
- Connector<TOptions, TConnection>
The connector.