Class ConnectionDescriptor
- Namespace
- ArcanaDevelopment.adTempus.Shared
- Assembly
- ArcanaDevelopment.adTempus.Shared.dll
Reads or writes an adTempus server connection string
public sealed class ConnectionDescriptor
- Inheritance
-
objectConnectionDescriptor
Constructors
ConnectionDescriptor()
Creates a new connection descriptor to connect
public ConnectionDescriptor()
Remarks
The default descriptor connects to the default instance on the local computer using Windows security.
ConnectionDescriptor(string, int?, string)
Creates a new connection descriptor
public ConnectionDescriptor(string server, int? port, string instance)
Parameters
| Name | Type | Description |
|---|---|---|
server |
string | The name or IP address of the computer to connect to. Specify null, an empty string, ".", or "localhost" to connect to the local computer |
port |
int? | The port to connect to. Specify null to use the default port (3760). |
instance |
string | The instance to connect to. Specify null or an empty string to connect to the default instance. |
Properties
AdditionalProperties
Collection of additional properties used to configure the connection
public Dictionary<string, string> AdditionalProperties { get; }
Property Value
- Dictionary<string, string>
ComputerName
The name of the computer to connect to
public string ComputerName { get; set; }
Property Value
- string
DnsIdentity
The DNS identity set for the connection
public string DnsIdentity { get; }
Property Value
- string
Remarks
This property returns the value of the "dnsidentity" AdditionalProperty, or the ComputerName if no value has been set.
Identity
The identity information used for the connection
public ConnectionDescriptor.IdentityInfo Identity { get; set; }
Property Value
InstanceName
The name of the instance to connect to.
public string InstanceName { get; set; }
Property Value
- string
Remarks
Set to null, an empty string, or "default" to connect to the default instance.
PortNumber
The port number to connect to.
public int PortNumber { get; set; }
Property Value
- int
Remarks
The default port is 3760
SPN
The SPN to use when connecting to the server.
public string SPN { get; set; }
Property Value
- string
SecurityType
The type of security used for the connection
public ConnectionSecurityType SecurityType { get; set; }
Property Value
UseDefaultInstance
Indicates whether this descriptor uses the default instance
public bool UseDefaultInstance { get; }
Property Value
- bool
Remarks
This property is shorthand for checking the value of the InstanceName.
UseDefaultPort
Indicates whether this descriptor uses the default port
public bool UseDefaultPort { get; }
Property Value
- bool
Remarks
This property is shorthand for checking the value of the PortNumber.
Methods
BuildConnectionDescriptor(string, int?, string)
Creates a ConnectionDescriptor for the specified parameters and returns a string representation
public static string BuildConnectionDescriptor(string computerName, int? portNumber, string instanceName)
Parameters
| Name | Type | Description |
|---|---|---|
computerName |
string | The name or IP address of the computer to connect to. Use null or empty for local computer |
portNumber |
int? | The port to connect to. Specify null to use the default port |
instanceName |
string | The instance to connect to. Use null or empty for default instance |
Returns
- string
GetAdditionalProperty(string, string)
Gets the value from AdditionalProperties with the specified key.
public string GetAdditionalProperty(string key, string defaultValue = null)
Parameters
| Name | Type | Description |
|---|---|---|
key |
string | |
defaultValue |
string | The value returned if the key is not found. |
Returns
- string
The value for the specified key, or defaultValue if the key is not found.
Parse(string)
Parses a connection string.
public static ConnectionDescriptor Parse(string connectionString)
Parameters
| Name | Type | Description |
|---|---|---|
connectionString |
string | The connection string to parse (created by ToString()) |
Returns
- ConnectionDescriptor
A ConnectionDescriptor containing information parsed from the target, or null if the target cannot be parsed.
Remarks
This method parses a user-entered target address. Following are valid address forms:
- servername
- servername:port
- servername:port\instance
- servername\instance
- Deprecated formats still recognized by Parse:
- servername,port
- servername\instance,port
- servername,port\instance Any of these formats can also be followed by "," and additional configuration options
ReadAdditionalProperties(string)
Reads additional configuration properties set in the connection string.
public void ReadAdditionalProperties(string source)
Parameters
| Name | Type | Description |
|---|---|---|
source |
string |
Remarks
Following the base connectionstring, additional properties can be specified in the form: ,key 1=value 1,key2,key3=value 3
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.