SqlConnectionStringBuilder Class

Definition

为创建和管理由 SqlConnection 类使用的连接字符串的内容提供了一种简单方法。Provides a simple way to create and manage the contents of connection strings used by the SqlConnection class.

public ref class SqlConnectionStringBuilder sealed : System::Data::Common::DbConnectionStringBuilder
public sealed class SqlConnectionStringBuilder : System.Data.Common.DbConnectionStringBuilder
[System.ComponentModel.TypeConverter(typeof(System.Data.SqlClient.SqlConnectionStringBuilder/SqlConnectionStringBuilderConverter))]
public sealed class SqlConnectionStringBuilder : System.Data.Common.DbConnectionStringBuilder
type SqlConnectionStringBuilder = class
    inherit DbConnectionStringBuilder
Public NotInheritable Class SqlConnectionStringBuilder
Inherits DbConnectionStringBuilder
Inheritance
SqlConnectionStringBuilder
Attributes

Examples

下面的控制台应用程序将生成 SQL Server 数据库的连接字符串。The following console application builds connection strings for a SQL Server database. 该代码使用 SqlConnectionStringBuilder 类创建连接字符串,然后将 ConnectionString 实例的 SqlConnectionStringBuilder 属性传递到连接类的构造函数。The code uses a SqlConnectionStringBuilder class to create the connection string, and then passes the ConnectionString property of the SqlConnectionStringBuilder instance to the constructor of the connection class. 该示例还分析了现有连接字符串,并演示了各种操作连接字符串的内容的方法。The example also parses an existing connection string and demonstrates various ways of manipulating the connection string's contents.

Note

该示例包括一个密码以演示 SqlConnectionStringBuilder 如何使用连接字符串。This example includes a password to demonstrate how SqlConnectionStringBuilder works with connection strings. 在您的应用程序中,建议使用 Windows 身份验证。In your applications, we recommend that you use Windows Authentication. 如果必须使用密码,请不要在你的应用程序中包括硬编码的密码。If you must use a password, do not include a hard-coded password in your application.

using System.Data;
using System.Data.SqlClient;

class Program
{
    static void Main()
    {
        // Create a new SqlConnectionStringBuilder and
        // initialize it with a few name/value pairs.
        SqlConnectionStringBuilder builder =
            new SqlConnectionStringBuilder(GetConnectionString());

        // The input connection string used the
        // Server key, but the new connection string uses
        // the well-known Data Source key instead.
        Console.WriteLine(builder.ConnectionString);

        // Pass the SqlConnectionStringBuilder an existing
        // connection string, and you can retrieve and
        // modify any of the elements.
        builder.ConnectionString = "server=(local);user id=ab;" +
            "password= a!Pass113;initial catalog=AdventureWorks";

        // Now that the connection string has been parsed,
        // you can work with individual items.
        Console.WriteLine(builder.Password);
        builder.Password = "new@1Password";
        builder.AsynchronousProcessing = true;

        // You can refer to connection keys using strings,
        // as well. When you use this technique (the default
        // Item property in Visual Basic, or the indexer in C#),
        // you can specify any synonym for the connection string key
        // name.
        builder["Server"] = ".";
        builder["Connect Timeout"] = 1000;
        builder["Trusted_Connection"] = true;
        Console.WriteLine(builder.ConnectionString);

        Console.WriteLine("Press Enter to finish.");
        Console.ReadLine();
    }

    private static string GetConnectionString()
    {
        // To avoid storing the connection string in your code,
        // you can retrieve it from a configuration file.
        return "Server=(local);Integrated Security=SSPI;" +
            "Initial Catalog=AdventureWorks";
    }
}
Imports System.Data.SqlClient

Module Module1
    Sub Main()
        ' Create a new SqlConnectionStringBuilder and
        ' initialize it with a few name/value pairs:
        Dim builder As New SqlConnectionStringBuilder(GetConnectionString())

        ' The input connection string used the 
        ' Server key, but the new connection string uses
        ' the well-known Data Source key instead.
        Console.WriteLine(builder.ConnectionString)

        ' Pass the SqlConnectionStringBuilder an existing 
        ' connection string, and you can retrieve and
        ' modify any of the elements.
        builder.ConnectionString = _
            "server=(local);user id=ab;" & _
            "password=a!Pass113;initial catalog=AdventureWorks"
        ' Now that the connection string has been parsed,
        ' you can work with individual items.
        Console.WriteLine(builder.Password)
        builder.Password = "new@1Password"
        builder.AsynchronousProcessing = True

        ' You can refer to connection keys using strings, 
        ' as well. When you use this technique (the default
        ' Item property in Visual Basic, or the indexer in C#)
        ' you can specify any synonym for the connection string key
        ' name.
        builder("Server") = "."
        builder("Connect Timeout") = 1000

        ' The Item property is the default for the class, 
        ' and setting the Item property adds the value to the 
        ' dictionary, if necessary. 
        builder.Item("Trusted_Connection") = True
        Console.WriteLine(builder.ConnectionString)

        Console.WriteLine("Press Enter to finish.")
        Console.ReadLine()
    End Sub

    Private Function GetConnectionString() As String
        ' To avoid storing the connection string in your code,
        ' you can retrieve it from a configuration file. 
        Return "Server=(local);Integrated Security=SSPI;" & _
          "Initial Catalog=AdventureWorks"
    End Function
End Module

Remarks

通过连接字符串生成器,开发人员可以使用该类的属性和方法,以编程方式创建语法正确的连接字符串以及分析和重新生成现有的连接字符串。The connection string builder lets developers programmatically create syntactically correct connection strings, and parse and rebuild existing connection strings, using properties and methods of the class. 连接字符串生成器提供了与 SQL Server 允许的已知键/值对相对应的强类型属性。The connection string builder provides strongly typed properties corresponding to the known key/value pairs allowed by SQL Server. 需要在应用程序中创建连接字符串的开发人员可以使用 SqlConnectionStringBuilder 类生成和修改连接字符串。Developers needing to create connection strings as part of applications can use the SqlConnectionStringBuilder class to build and modify connection strings. 使用该类还可以轻松管理存储在应用程序配置文件中的连接字符串。The class also makes it easy to manage connection strings stored in an application configuration file.

SqlConnectionStringBuilder 对键/值对的有效性进行检查。The SqlConnectionStringBuilder performs checks for valid key/value pairs. 因此,您不能使用该类创建无效的连接字符串;尝试添加无效对将引发异常。Therefore, you cannot use this class to create invalid connection strings; trying to add invalid pairs will throw an exception. 该类保持一个固定的同义词集合,可以将同义词转换为相应的已知键名。The class maintains a fixed collection of synonyms and can translate from a synonym to the corresponding well-known key name.

例如,使用Item属性检索值时,可以指定一个字符串,该字符串包含所需的键的任何同义词。For example, when you use the Item property to retrieve a value, you can specify a string that contains any synonym for the key you need. 例如,当你使用需要包含密钥名称的字符串的任何成员(例如Item属性或 Remove 方法)时,可以在连接字符串中为此密钥指定 "网络地址"、"地址" 或任何其他可接受的同义词。For example, you can specify "Network Address", "addr", or any other acceptable synonym for this key within a connection string when you use any member that requires a string that contains the key name, such as the Item property or the Remove method. 有关可接受同义词的完整列表,请参见 ConnectionString 属性。See the ConnectionString property for a full list of acceptable synonyms.

Item属性处理尝试插入恶意条目。The Item property handles tries to insert malicious entries. 例如,下面的代码使用默认 Item 属性(在 C# 中为索引器)正确转义嵌套的键/值对:For example, the following code, using the default Item property (the indexer, in C#) correctly escapes the nested key/value pair:

Dim builder As New System.Data.SqlClient.SqlConnectionStringBuilder
builder("Data Source") = "(local)"
builder("Integrated Security") = True
builder("Initial Catalog") = "AdventureWorks;NewValue=Bad"
Console.WriteLine(builder.ConnectionString)
System.Data.SqlClient.SqlConnectionStringBuilder builder =
  new System.Data.SqlClient.SqlConnectionStringBuilder();
builder["Data Source"] = "(local)";
builder["integrated Security"] = true;
builder["Initial Catalog"] = "AdventureWorks;NewValue=Bad";
Console.WriteLine(builder.ConnectionString);

结果为以下连接字符串,该字符串以安全方式处理无效值:The result is the following connection string that handles the invalid value in a safe manner:

Source=(local);Initial Catalog="AdventureWorks;NewValue=Bad";
Integrated Security=True

Constructors

SqlConnectionStringBuilder()

初始化 SqlConnectionStringBuilder 类的新实例。Initializes a new instance of the SqlConnectionStringBuilder class.

SqlConnectionStringBuilder(String)

初始化 SqlConnectionStringBuilder 类的新实例。Initializes a new instance of the SqlConnectionStringBuilder class. 所提供的连接字符串为实例的内部连接信息提供数据。The provided connection string provides the data for the instance's internal connection information.

Properties

ApplicationIntent

连接到 SQL Server 可用性组中的数据库时声明应用程序工作负荷类型。Declares the application workload type when connecting to a database in an SQL Server Availability Group. 您可以使用 ApplicationIntent 设置此属性的值。You can set the value of this property with ApplicationIntent. 有关对 Always On 可用性组的 SqlClient 支持的详细信息,请参阅对高可用性、灾难恢复的 SqlClient 支持For more information about SqlClient support for Always On Availability Groups, see SqlClient Support for High Availability, Disaster Recovery.

ApplicationName

获取或设置与连接字符串关联的应用程序的名称。Gets or sets the name of the application associated with the connection string.

AsynchronousProcessing

获取或设置一个布尔值,该值指定使用此连接字符串创建的连接是否允许异步处理。Gets or sets a Boolean value that indicates whether asynchronous processing is allowed by the connection created by using this connection string.

AttachDBFilename

获取或设置包含主数据文件名称的字符串。Gets or sets a string that contains the name of the primary data file. 该字符串包括可附加数据库的完整路径名。This includes the full path name of an attachable database.

Authentication

获取连接字符串的身份验证。Gets the authentication of the connection string.

BrowsableConnectionString

获取或设置一个值,该值指示 ConnectionString 属性是否在 Visual Studio 设计器中可见。Gets or sets a value that indicates whether the ConnectionString property is visible in Visual Studio designers.

(Inherited from DbConnectionStringBuilder)
ColumnEncryptionSetting

获取或设置连接字符串生成器的列加密设置。Gets or sets the column encryption settings for the connection string builder.

ConnectionReset

已过时。Obsolete. 获取或设置一个布尔值,该值指示在从连接池中提取连接时是否重置连接。Gets or sets a Boolean value that indicates whether the connection is reset when drawn from the connection pool.

ConnectionString

获取或设置与 DbConnectionStringBuilder 相关联的连接字符串。Gets or sets the connection string associated with the DbConnectionStringBuilder.

(Inherited from DbConnectionStringBuilder)
ConnectRetryCount

在确定有一个空闲的连接失败之后尝试重新连接的次数。The number of reconnections attempted after identifying that there was an idle connection failure. 该值必须是介于 0 和 255 之间的整数。This must be an integer between 0 and 255. 默认值为 1。Default is 1. 设置为 0 将禁止在空闲连接失败时重新连接。Set to 0 to disable reconnecting on idle connection failures. 如果设置的值超过允许的范围,则将引发 ArgumentExceptionAn ArgumentException will be thrown if set to a value outside of the allowed range.

ConnectRetryInterval

标识空闲连接失败之后每次重新连接尝试之间的时间量(以秒为单位)。Amount of time (in seconds) between each reconnection attempt after identifying that there was an idle connection failure. 此值必须是介于 1 和 60 之间的整数。This must be an integer between 1 and 60. 默认为 10 秒。The default is 10 seconds. 如果设置的值超过允许的范围,则将引发 ArgumentExceptionAn ArgumentException will be thrown if set to a value outside of the allowed range.

ConnectTimeout

获取或设置在终止尝试并产生错误之前,等待与服务器连接的时间长度(以秒为单位)。Gets or sets the length of time (in seconds) to wait for a connection to the server before terminating the attempt and generating an error.

ContextConnection

获取或设置一个值,该值指示应建立与 SQL Server 的客户端/服务器连接还是进程内连接。Gets or sets a value that indicates whether a client/server or in-process connection to SQL Server should be made.

Count

获取属性 ConnectionString 中包含的键的当前数目。Gets the current number of keys that are contained within the ConnectionString property.

(Inherited from DbConnectionStringBuilder)
CurrentLanguage

获取或设置 SQL Server 语言记录名称。Gets or sets the SQL Server Language record name.

DataSource

获取或设置要连接到的 SQL Server 实例的名称或网络地址。Gets or sets the name or network address of the instance of SQL Server to connect to.

EnclaveAttestationUrl

获取或设置要与基于 enclave 的 Always Encrypted 搭配使用的 enclave 证明 URL。Gets or sets the enclave attestation Url to be used with enclave based Always Encrypted.

Encrypt

获取或设置一个布尔值,该值指示在服务器安装了证书的情况下,SQL Server 是否为客户端和服务器之间发送的所有数据使用 SSL 加密。Gets or sets a Boolean value that indicates whether SQL Server uses SSL encryption for all data sent between the client and server if the server has a certificate installed.

Enlist

获取或设置一个布尔值,该值指示 SQL Server 连接池程序是否在创建线程的当前事务上下文中自动登记连接。Gets or sets a Boolean value that indicates whether the SQL Server connection pooler automatically enlists the connection in the creation thread's current transaction context.

FailoverPartner

获取或设置在主服务器停机时要连接到的伙伴服务器的名称或地址。Gets or sets the name or address of the partner server to connect to if the primary server is down.

InitialCatalog

获取或设置与连接关联的数据库的名称。Gets or sets the name of the database associated with the connection.

IntegratedSecurity

获取或设置一个布尔值,该值指示是否在连接中指定用户 ID 和密码(值为 false 时),或者是否使用当前的 Windows 帐户凭据进行身份验证(值为 true 时)。Gets or sets a Boolean value that indicates whether User ID and Password are specified in the connection (when false) or whether the current Windows account credentials are used for authentication (when true).

IsFixedSize

获取一个值,该值指示 SqlConnectionStringBuilder 是否具有固定大小。Gets a value that indicates whether the SqlConnectionStringBuilder has a fixed size.

IsFixedSize

获取一个值,该值指示 DbConnectionStringBuilder 是否具有固定大小。Gets a value that indicates whether the DbConnectionStringBuilder has a fixed size.

(Inherited from DbConnectionStringBuilder)
IsReadOnly

获取一个值,该值指示 DbConnectionStringBuilder 是否为只读的。Gets a value that indicates whether the DbConnectionStringBuilder is read-only.

(Inherited from DbConnectionStringBuilder)
Item[String]

获取或设置与指定的键关联的值。Gets or sets the value associated with the specified key. 在 C# 中,此属性为索引器。In C#, this property is the indexer.

Keys

获取包含 ICollection 中的键的 SqlConnectionStringBuilderGets an ICollection that contains the keys in the SqlConnectionStringBuilder.

LoadBalanceTimeout

获取或设置连接被销毁前在连接池中存活的最短时间(以秒为单位)。Gets or sets the minimum time, in seconds, for the connection to live in the connection pool before being destroyed.

MaxPoolSize

获取或设置针对此特定连接字符串连接池中所允许的最大连接数。Gets or sets the maximum number of connections allowed in the connection pool for this specific connection string.

MinPoolSize

获取或设置针对此特定连接字符串连接池中所允许的最小连接数。Gets or sets the minimum number of connections allowed in the connection pool for this specific connection string.

MultipleActiveResultSets

如果为 true,则应用程序可以维护多个活动结果集 (MARS)。When true, an application can maintain multiple active result sets (MARS). 如果为 false,则应用程序必须先处理或取消某一批中的所有结果集,才可以在该连接上执行任何其他批次。When false, an application must process or cancel all result sets from one batch before it can execute any other batch on that connection.

有关详细信息,请参阅多个活动结果集 (MARS)For more information, see Multiple Active Result Sets (MARS).

MultiSubnetFailover

如果你的应用程序要连接到不同子网上的 AlwaysOn 可用性组 (AG),则设置 MultiSubnetFailover=true 会加快检测(当前)活动服务器以及与服务器的连接。If your application is connecting to an AlwaysOn availability group (AG) on different subnets, setting MultiSubnetFailover=true provides faster detection of and connection to the (currently) active server. 有关对 Always On 可用性组的 SqlClient 支持的详细信息,请参阅对高可用性、灾难恢复的 SqlClient 支持For more information about SqlClient support for Always On Availability Groups, see SqlClient Support for High Availability, Disaster Recovery.

NetworkLibrary

获取或设置一个字符串,该字符串包含用于建立与 SQL Server 的连接的网络库的名称。Gets or sets a string that contains the name of the network library used to establish a connection to the SQL Server.

PacketSize

获取或设置用来与 SQL Server 的实例通信的网络数据包的大小(以字节为单位)。Gets or sets the size in bytes of the network packets used to communicate with an instance of SQL Server.

Password

获取或设置 SQL Server 帐户的密码。Gets or sets the password for the SQL Server account.

PersistSecurityInfo

获取或设置一个布尔值,该值指示如果连接是打开的或者一直处于打开状态,那么安全敏感信息(如密码)是否将不作为连接的一部分返回。Gets or sets a Boolean value that indicates if security-sensitive information, such as the password, is not returned as part of the connection if the connection is open or has ever been in an open state.

PoolBlockingPeriod

连接池的暂停时段行为。The blocking period behavior for a connection pool.

Pooling

获取或设置一个布尔值,该值指示每次请求连接时该连接是汇入连接池还是显式打开。Gets or sets a Boolean value that indicates whether the connection will be pooled or explicitly opened every time that the connection is requested.

Replication

获取或设置一个布尔值,该值指示是否使用连接来支持复制。Gets or sets a Boolean value that indicates whether replication is supported using the connection.

TransactionBinding

获取或设置一个字符串值,该值表示连接如何保持与登记的 System.Transactions 事务的关联。Gets or sets a string value that indicates how the connection maintains its association with an enlisted System.Transactions transaction.

TransparentNetworkIPResolution

将该键的值设置为 true 时,需要应用程序检索特定 DNS 条目的所有 IP 地址并尝试连接到列表中的第一个地址。When the value of this key is set to true, the application is required to retrieve all IP addresses for a particular DNS entry and attempt to connect with the first one in the list. 如果未在 0.5 秒内建立连接,应用程序将尝试并行连接到所有其他地址。If the connection is not established within 0.5 seconds, the application will try to connect to all others in parallel. 第一个地址响应后,应用程序将与响应的 IP 地址建立连接。When the first answers, the application will establish the connection with the respondent IP address.

TrustServerCertificate

获取或设置一个值,该值指示在跳过用于验证信任的证书链遍历时是否加密信道。Gets or sets a value that indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.

TypeSystemVersion

获取或设置一个字符串值,该值指示应用程序所需的类型系统。Gets or sets a string value that indicates the type system the application expects.

UserID

获取或设置连接到 SQL Server 时要使用的用户 ID。Gets or sets the user ID to be used when connecting to SQL Server.

UserInstance

获取或设置一个值,该值指示是否将连接从默认的 SQL Server Express 实例重定向到在调用方帐户之下运行并且在运行时启动的实例。Gets or sets a value that indicates whether to redirect the connection from the default SQL Server Express instance to a runtime-initiated instance running under the account of the caller.

Values

获取一个包含 ICollection 中的值的 SqlConnectionStringBuilderGets an ICollection that contains the values in the SqlConnectionStringBuilder.

WorkstationID

获取或设置连接到 SQL Server 的工作站的名称。Gets or sets the name of the workstation connecting to SQL Server.

Methods

Add(String, Object)

将带有指定键和值的条目添加到 DbConnectionStringBuilder 中。Adds an entry with the specified key and value into the DbConnectionStringBuilder.

(Inherited from DbConnectionStringBuilder)
Clear()

清除 SqlConnectionStringBuilder 实例的内容。Clears the contents of the SqlConnectionStringBuilder instance.

ClearPropertyDescriptors()

清除关联的 DbConnectionStringBuilder 上的 PropertyDescriptor 对象集合。Clears the collection of PropertyDescriptor objects on the associated DbConnectionStringBuilder.

(Inherited from DbConnectionStringBuilder)
ContainsKey(String)

确定 SqlConnectionStringBuilder 是否包含特定键。Determines whether the SqlConnectionStringBuilder contains a specific key.

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
EquivalentTo(DbConnectionStringBuilder)

将此 DbConnectionStringBuilder 对象中的连接信息与提供的对象中的连接信息进行比较。Compares the connection information in this DbConnectionStringBuilder object with the connection information in the supplied object.

(Inherited from DbConnectionStringBuilder)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetProperties(Hashtable)

使用有关此 DbConnectionStringBuilder 的所有属性的信息,填充提供的 HashtableFills a supplied Hashtable with information about all the properties of this DbConnectionStringBuilder.

(Inherited from DbConnectionStringBuilder)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
Remove(String)

SqlConnectionStringBuilder 实例中移除具有指定的键的项。Removes the entry with the specified key from the SqlConnectionStringBuilder instance.

ShouldSerialize(String)

指示此 SqlConnectionStringBuilder 实例中是否存在指定的键。Indicates whether the specified key exists in this SqlConnectionStringBuilder instance.

ToString()

返回与此 DbConnectionStringBuilder 关联的连接字符串。Returns the connection string associated with this DbConnectionStringBuilder.

(Inherited from DbConnectionStringBuilder)
TryGetValue(String, Object)

从此 SqlConnectionStringBuilder 中检索与提供的键相对应的值。Retrieves a value corresponding to the supplied key from this SqlConnectionStringBuilder.

Explicit Interface Implementations

ICollection.CopyTo(Array, Int32)

从特定的 ICollection 索引开始,将 Array 的元素复制到一个 Array 中。Copies the elements of the ICollection to an Array, starting at a particular Array index.

(Inherited from DbConnectionStringBuilder)
ICollection.IsSynchronized

获取一个值,该值指示是否同步对 ICollection 的访问(确保线程安全)。Gets a value indicating whether access to the ICollection is synchronized (thread safe).

(Inherited from DbConnectionStringBuilder)
ICollection.SyncRoot

获取用于同步对 ICollection 的访问的对象。Gets an object that can be used to synchronize access to the ICollection.

(Inherited from DbConnectionStringBuilder)
ICustomTypeDescriptor.GetAttributes()

返回此组件实例的自定义属性的集合。Returns a collection of custom attributes for this instance of a component.

(Inherited from DbConnectionStringBuilder)
ICustomTypeDescriptor.GetClassName()

返回此组件实例的类名称。Returns the class name of this instance of a component.

(Inherited from DbConnectionStringBuilder)
ICustomTypeDescriptor.GetComponentName()

返回某个组件的此实例的名称。Returns the name of this instance of a component.

(Inherited from DbConnectionStringBuilder)
ICustomTypeDescriptor.GetConverter()

返回此组件实例的类型转换器。Returns a type converter for this instance of a component.

(Inherited from DbConnectionStringBuilder)
ICustomTypeDescriptor.GetDefaultEvent()

返回此组件实例的默认事件。Returns the default event for this instance of a component.

(Inherited from DbConnectionStringBuilder)
ICustomTypeDescriptor.GetDefaultProperty()

返回此组件实例的默认属性。Returns the default property for this instance of a component.

(Inherited from DbConnectionStringBuilder)
ICustomTypeDescriptor.GetEditor(Type)

返回此组件实例的指定类型的编辑器。Returns an editor of the specified type for this instance of a component.

(Inherited from DbConnectionStringBuilder)
ICustomTypeDescriptor.GetEvents()

返回此组件实例的事件。Returns the events for this instance of a component.

(Inherited from DbConnectionStringBuilder)
ICustomTypeDescriptor.GetEvents(Attribute[])

使用指定的属性数组作为筛选器,返回此组件实例的事件。Returns the events for this instance of a component using the specified attribute array as a filter.

(Inherited from DbConnectionStringBuilder)
ICustomTypeDescriptor.GetProperties()

返回此组件实例的属性。Returns the properties for this instance of a component.

(Inherited from DbConnectionStringBuilder)
ICustomTypeDescriptor.GetProperties(Attribute[])

使用特性数组作为筛选器,返回此组件实例的属性。Returns the properties for this instance of a component using the attribute array as a filter.

(Inherited from DbConnectionStringBuilder)
ICustomTypeDescriptor.GetPropertyOwner(PropertyDescriptor)

返回一个对象,该对象包含由指定的属性描述符描述的属性。Returns an object that contains the property described by the specified property descriptor.

(Inherited from DbConnectionStringBuilder)
IDictionary.Add(Object, Object)

IDictionary 对象中添加一个带有所提供的键和值的元素。Adds an element with the provided key and value to the IDictionary object.

(Inherited from DbConnectionStringBuilder)
IDictionary.Contains(Object)

确定 IDictionary 对象是否包含具有指定键的元素。Determines whether the IDictionary object contains an element with the specified key.

(Inherited from DbConnectionStringBuilder)
IDictionary.GetEnumerator()

返回 IDictionary 对象的 IDictionaryEnumerator 对象。Returns an IDictionaryEnumerator object for the IDictionary object.

(Inherited from DbConnectionStringBuilder)
IDictionary.IsFixedSize (Inherited from DbConnectionStringBuilder)
IDictionary.IsReadOnly (Inherited from DbConnectionStringBuilder)
IDictionary.Item[Object]

获取或设置具有指定键的元素。Gets or sets the element with the specified key.

(Inherited from DbConnectionStringBuilder)
IDictionary.Remove(Object)

IDictionary 对象中移除具有指定键的元素。Removes the element with the specified key from the IDictionary object.

(Inherited from DbConnectionStringBuilder)
IEnumerable.GetEnumerator()

返回循环访问集合的枚举器。Returns an enumerator that iterates through a collection.

(Inherited from DbConnectionStringBuilder)

Extension Methods

Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

启用查询的并行化。Enables parallelization of a query.

AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryableConverts an IEnumerable to an IQueryable.

Applies to

See also