SqlConnection::ColumnEncryptionQueryMetadataCacheEnabled Property

 

Gets or sets a value that indicates whether query metadata caching is enabled (true) or not (false) for parameterized queries running against Always Encrypted enabled databases. The default value is true.

Namespace:   System.Data.SqlClient
Assembly:  System.Data (in System.Data.dll)

public:
property bool ColumnEncryptionQueryMetadataCacheEnabled {
	static bool get();
	static void set(bool value);
}

Property Value

Type: System::Boolean

Returns true if query metadata caching is enabled; otherwise false. true is the default.

For parameterized queries, SqlClient makes a roundtrip to SQL Server for parameter metadata, to see which parameter it needs to encrypt and how (which keys and algorithms should be used). If the application calls the same query multiple times, an extra roundtrip is made to the server each time, which degrades application performance.

With ColumnEncryptionQueryMetadataCacheEnabled set to true, if the same query is called multiple times, the roundtrip to the server will be made only once. The cache has a non-configurable Max size parameter that is set to 2000 queries.

.NET Framework
Available since 4.6.2
Return to top
Show: