Description
The ConnectionUtils class provides a set of utility functions used to process connection parameters.
Static methods
ComposeUri
Composes URI from config parameters. The result URI will be in the following form: protocol://username@password@host1:port1,host2:port2,…?param1=abc¶m2=xyz&…
public static
string ComposeUri(ConfigParams options, string defaultProtocol, int defaultPort)
- options: ConfigParams - configuration parameters
- defaultProtocol: string - default protocol
- defaultPort: int - default port
- returns: string - composed URI
Concat
Concatenates two options by combining duplicated properties into a comma-separated list.
public static
ConfigParams Concat(ConfigParams options1, ConfigParams options2, params string[] keys)
- options1: ConfigParams - first options to merge
- options2: ConfigParams - second options to merge
- keys: string[] - when defined, it limits only to specific keys
- returns: ConfigParams - new connection parameters to be added
Exclude
Excludes specified keys from the config parameters.
public static
ConfigParams Exclude(ConfigParams options, params string[] keys)
- options: ConfigParams - configuration parameters to be processed.
- keys: string[] - list of keys to be excluded.
- returns: ConfigParams - processed config parameters.
Include
Includes specified keys from the config parameters.
public static
ConfigParams Include(ConfigParams options, params string[] keys)
- options: ConfigParams - configuration parameters to be processed.
- keys: string[] - list of keys to be included.
- returns: ConfigParams - processed config parameters.
ParseUri
Parses an URI into config parameters.
The URI shall be in the following form:
protocol://username@password@host1:port1,host2:port2,...?param1=abc¶m2=xyz&...
public static
ConfigParams ParseUri(string uri, string defaultProtocol, string defaultPort)
- uri: string - URI to be parsed
- defaultProtocol: string - default protocol
- defaultPort: string - default port
- returns: ConfigParams - configuration parameters with URI elements