Skip to content

Proposal: EF.Parameter(value).OptimizeFor(constantValue) #36978

@arontsang

Description

@arontsang

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions