SqlConnection.ColumnEncryptionQueryMetadataCacheEnabled Property

Definition

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.

public:
 static property bool ColumnEncryptionQueryMetadataCacheEnabled { bool get(); void set(bool value); };
public static bool ColumnEncryptionQueryMetadataCacheEnabled { get; set; }
static member ColumnEncryptionQueryMetadataCacheEnabled : bool with get, set
Public Shared Property ColumnEncryptionQueryMetadataCacheEnabled As Boolean

Property Value

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

Remarks

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.

Applies to