Proposal: EF.Parameter(value).OptimizeFor(constantValue)
Open
area-query
area-sqlserver
customer-reported
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.4k
- PR merge metrics
- PR metrics pending
Description
### What problem are you trying to solve?
Sometimes SQL Server does not generate optimal query plans based on parameter sniffing alone.
By injecting a value for EF to generate a query hint for, we can give SQL Server a better chance to generate optimal queries.
### Describe the solution you'd like
Add the fluent api EF.Parameter(value).OptimizeFor(constantValue) which then adds
`Option(Optimize For \@p__linq__0 = 'constantValue')` into the command text.
Contributor guide
Assessment
This issue has not been assessed yet.