Skip to content

For MSSQL Parameters are created with length based on their value not the underlying model length this causes plan reuse issues #2626

@simonsabin

Description

@simonsabin

Currently string and binary parameters are added without a length meaning you get multiple queries and plans causing bloat and is impossible to manage from a query store plan perspective as one, you end up with 100s of queries with the same hash, but are different queries and also differing plans. Query is just varying by the length of the definition of the parameter. (See below)

The DBConnectionParam needs a length and the creation of params should use length where possible.

This could obtain the length of the underlying model as it does to get the type of the underlying model column

public virtual string MakeDbConnectionParam(object? value, string? paramName = null)

image

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

Status

Review In Progress

Relationships

None yet

Development

No branches or pull requests

Issue actions