Share via


DataConnectionProperties.GetValueAsString Method

Formats a property value for placement in a connection string.

Namespace:  Microsoft.VisualStudio.Data.Framework
Assembly:  Microsoft.VisualStudio.Data.Framework (in Microsoft.VisualStudio.Data.Framework.dll)

Syntax

'Declaration
Protected Overridable Function GetValueAsString ( _
    key As String _
) As String
protected virtual string GetValueAsString(
    string key
)
protected:
virtual String^ GetValueAsString(
    String^ key
)
abstract GetValueAsString : 
        key:string -> string  
override GetValueAsString : 
        key:string -> string
protected function GetValueAsString(
    key : String
) : String

Parameters

  • key
    Type: System.String

    The name of a property to be formatted.

Return Value

Type: System.String
The value of the specified property in a string format suitable for placement in a connection string.

Exceptions

Exception Condition
ArgumentNullException

The key parameter is nulla null reference (Nothing in Visual Basic).

Remarks

This method is called by the base implementation of ToDisplayString and ToSafeString when formatting property values to be placed in the output string.

The base implementation of this method gets the PropertyDescriptor for the property and uses its TypeConverter to produce a string representation, and then it applies the following formatting rules:

  • If the property value is an Enum type that is marked with the FlagsAttribute, replace every comma (",") with a pipe ("|").

  • If the property value contains one or more single quotation marks ('), change each to two single quotation marks ('').

  • If the property value contains the key/value separator or property entry separator (as specified in the constructor), double quotation marks ("), a single quotation mark ('), or starts or ends with spaces, enclose the entire value in single quotation marks (').

.NET Framework Security

See Also

Reference

DataConnectionProperties Class

Microsoft.VisualStudio.Data.Framework Namespace