-
Notifications
You must be signed in to change notification settings - Fork 933
* Basic support for T-SQL query hints. #3008
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
/// </summary> | ||
/// <param name="hint">The t-sql query hint</param> | ||
/// <returns><see langword="this" /> (for method chaining).</returns> | ||
IQueryableOptions SetHint(string hint); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This interface should not be changed. It is obsolete.
/// empty superclass implementation merely returns its first | ||
/// argument. | ||
/// </summary> | ||
protected virtual SqlString ApplyHint(SqlString sql, string hints, Dialect.Dialect dialect) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is not used anywhere.
@@ -343,9 +351,9 @@ protected override IResultTransformer ResolveResultTransformer(IResultTransforme | |||
Object[] resultRow = GetResultRow(row, rs, session); | |||
bool hasTransform = HasSelectNew || resultTransformer != null; | |||
return (!hasTransform && resultRow.Length == 1 | |||
? resultRow[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert these changes.
@@ -441,7 +449,7 @@ internal IEnumerable GetEnumerable(QueryParameters queryParameters, IEventSource | |||
var rs = GetResultSet(cmd, queryParameters, session, null); | |||
|
|||
var resultTransformer = _selectNewTransformer ?? queryParameters.ResultTransformer; | |||
IEnumerable result = | |||
IEnumerable result = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert this changes
@@ -62,5 +63,11 @@ public bool DefinesLimits | |||
{ | |||
get { return maxRows != NoValue || firstRow > 0; } | |||
} | |||
|
|||
public string Hint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a strange place to add query hint...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would be a better place?
The PR is incomplete. The hints are set, but not used by anything. And it lacks tests. We cannot accept PRs without tests |
I'm going to close this PR as it is incomplete as far as I concern. |
With this patch a basic support for T-SQL query hints is provided. It is possible to use:
.WithOptions(u => u.SetHint("RECOMPILE"))