ADO.NET provider for Dynamics 365 Sales implements connection pooling to reduce the efforts of repeatedly opening and closing connections. A connection pool is a cache of database connections maintained where user can reuse existing active connections with the same connection string instead of creating new connections when a request is made to the database.
Connection?pooling is used to enhance the performance of executing commands on a database. The provider supports pooling, by default with the pool size set to 100. However, pooling can be disabled by setting the UsePool property to false.
The following example demonstrates the implementation of connection pooling in ADO.Net provider for Dynamics 365 Sales with Max Pool Size key set to 20, indicating that the maximum number of connections in the pool should be 20.
C# |
コードのコピー
|
---|---|
//接続プーリングを使用する場合: 接続オブジェクトがプール内ですでに使用可能であるため、時間を節約できます。 string connectionString = $@"Url = {urlDynamics}; Use Cache = true; Use Etag = true; OAuth Client Id = {clientID}; Username = {username}; Password = {password}; OAuth Token Endpoint = {tokenEnpoint}; OAuth Extend Properties = {extendProperties}; Max Pool Size = 20"; |
The following example demonstrates how to disable connection pooling by setting the "Use Pool" property to false in the connection string.
C# |
コードのコピー
|
---|---|
//接続プーリングを使用しない場合 string connectionString = $@"Url = {urlDynamics}; Use Cache = true; Use Etag = true; OAuth Client Id = {clientID}; Username = {username}; Password = {password}; OAuth Token Endpoint = {tokenEnpoint}; OAuth Extend Properties = {extendProperties}; Use Pool = false"; |