ADO.NET 新增功能What's New in ADO.NET

以下功能是 .NET Framework 4.5 中 ADO.NET 的新增功能。The following features are new in ADO.NET in the .NET Framework 4.5.

SqlClient Data ProviderSqlClient Data Provider

以下功能是 .NET Framework 4.5 中 SQL Server 的 .NET Framework 数据提供程序中的新增功能:The following features are new in the .NET Framework Data Provider for SQL Server in .NET Framework 4.5:

  • ConnectRetryCount 和 ConnectRetryInterval 连接字符串关键字 (ConnectionString) 可以让你控制空闲连接复原功能。The ConnectRetryCount and ConnectRetryInterval connection string keywords (ConnectionString) let you control the idle connection resiliency feature.

  • 从 SQL Server 到应用程序的流式处理支持支持服务器上的数据是非结构化的情况。Streaming support from SQL Server to an application supports scenarios where data on the server is unstructured. 有关详细信息,请参阅 SqlClient 流支持See SqlClient Streaming Support for more information.

  • 已添加了异步编程支持。Support has been added for asynchronous programming. 有关详细信息,请参阅 异步编程See Asynchronous Programming for more information.

  • 连接故障现在将记录在扩展事件日志中。Connection failures will now be logged in the extended events log. 有关详细信息,请参阅 ADO.NET 中的数据跟踪For more information, see Data Tracing in ADO.NET.

  • SqlClient 现在支持 SQL Server 的高可用性、灾难恢复功能、AlwaysOn。SqlClient now has support for SQL Server's high availability, disaster recovery feature, AlwaysOn. 有关详细信息,请参阅 SqlClient 对高可用性、灾难恢复的支持For more information, see SqlClient Support for High Availability, Disaster Recovery.

  • 使用 SQL Server 身份验证时,可以将密码作为传递 SecureStringA password can be passed as a SecureString when using SQL Server Authentication. 有关更多信息,请参见SqlCredentialSee SqlCredential for more information.

  • 如果 TrustServerCertificate 为 false 且 Encrypt 为 true,则 SQL Server SSL 证书中的服务器名称 (或 ip) 地址必须与连接字符串中指定的服务器名称 (或 ip) 地址完全匹配。When TrustServerCertificate is false and Encrypt is true, the server name (or IP address) in a SQL Server SSL certificate must exactly match the server name (or IP address) specified in the connection string. 否则,连接尝试将失败。Otherwise, the connection attempt will fail. 有关更多信息,请参见 EncryptConnectionString 选项的说明。For more information, see the description of the Encrypt connection option in ConnectionString.

    如果此更改导致现有应用程序不再连接,可以通过以下方法之一修复应用程序:If this change causes an existing application to no longer connect, you can fix the application using one of the following:

    • 颁发证书,以在公用名 (CN) 或主题备用名称 (SAN) 字段中指定短名称。Issue a certificate that specifies the short name in the Common Name (CN) or Subject Alternative Name (SAN) field. 此解决方案将适用于数据库镜像。This solution will work for database mirroring.

    • 添加别名,将短名称映射到完全限定的域名。Add an alias that maps the short name to the fully-qualified domain name.

    • 在连接字符串中使用完全限定的域名。Use the fully-qualified domain name in the connection string.

  • SqlClient 支持扩展保护。SqlClient supports Extended Protection. 有关扩展保护的详细信息,请参阅 使用扩展保护连接到数据库引擎For more information about Extended Protection, see Connecting to the Database Engine Using Extended Protection.

  • SqlClient 支持连接到 LocalDB 数据库。SqlClient supports connections to LocalDB databases. 有关详细信息,请参阅 SqlClient 对 LocalDB 的支持For more information, see SqlClient Support for LocalDB.

  • Type System Version=SQL Server 2012; 是传递给 Type System Version 连接属性的新值。Type System Version=SQL Server 2012; is new value to pass to the Type System Version connection property. Type System Version=Latest; 值现已过时,它与 Type System Version=SQL Server 2008; 等效。The Type System Version=Latest; value is now obsolete and has been made equivalent to Type System Version=SQL Server 2008;. 有关详细信息,请参阅 ConnectionStringFor more information, see ConnectionString.

  • SqlClient 为稀疏列(SQL Server 2008 中新增的功能)提供额外支持。SqlClient provides additional support for sparse columns, a feature that was added in SQL Server 2008. 如果应用程序已访问使用稀疏列的表中的数据,应看到性能有所提高。If your application already accesses data in a table that uses sparse columns, you should see an increase in performance. GetSchemaTable 的 IsColumnSet 列指示某列是否为属于列集成员的稀疏列。The IsColumnSet column of GetSchemaTable indicates if a column is a sparse column that is a member of a column set. GetSchema 指示列是否为稀疏列 (参阅 SQL Server 架构集合 以获取) 详细信息。GetSchema indicates if a column is a sparse column (see SQL Server Schema Collections for more information). 有关稀疏列的详细信息,请参阅 使用稀疏列For more information about sparse columns, see Use Sparse Columns.

  • 包含空间数据类型的程序集 Microsoft.SqlServer.Types.dll 已从 10.0 版本升级到版本 11.0。The assembly Microsoft.SqlServer.Types.dll, which contains the spatial data types, has been upgraded from version 10.0 to version 11.0. 引用此程序集的应用程序可能失败。Applications that reference this assembly may fail. 有关详细信息,请参阅 数据库引擎功能的重大更改For more information, see Breaking Changes to Database Engine Features.

ADO.NET 实体框架ADO.NET Entity Framework

.NET Framework 4.5 添加了在使用实体框架5.0 时启用新方案的 Api。The .NET Framework 4.5 adds APIs that enable new scenarios when working with the Entity Framework 5.0. 有关添加到实体框架5.0 的改进和功能的详细信息,请参阅以下主题: 新增功能实体框架版本和版本控制For more information about improvements and features that were added to the Entity Framework 5.0, see the following topics: What’s New and Entity Framework Releases and Versioning.

请参阅See also