PawelGerr/Thinktecture.EntityFrameworkCore

[FeatureRequest] Add hint for (Index(idx_some_name))

Closed this issue · 2 comments

I have a need to add sql hints to force a query plan to use a specific index. It looks like your project is the perfect place to extend this feature, so I was wondering if you share this opinion.

Here could be an example usage:

var product = await _ctx.Products
.WithTableHints(SqlServerTableHint.Index("idx_prd_loc"))
.FirstAsync(p => p.Id == id);

This would generate sql leveraging the current code base as:

... products with(index(idx_prod_loc)) ...

Please check out the new version 4.5.0

var query = dbContext.TestEntities
                     .WithTableHints(SqlServerTableHint.Index("IX_TestEntities_Id"))

This looks perfect, and thank you for the quick turnaround.