You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have complex model with many references.
When I use TablesInScopeHint(SqlServerHints.Table.NoLock) it only adds a hint for explicitly specified tables in the query but ignores references.
Classes:
public class T1 {
public long Id { get; set; }
public long? T2Id { get; set; }
public T2 T2 { get; set; }
}
public class T2 {
public long Id { get; set; }
public string Name { get; set; }
}
Query:
var q =
from t in db.T1
select new {
t.Id,
t.T2.Name
};
var res = q.ToLinqToDB().TablesInScopeHint(SqlServerHints.Table.NoLock).ToList();
Result SQL:
SELECT
[t].[Id],
[t_T2].[Name]
FROM
[dbo].[T1] [t] WITH (NoLock)
LEFT JOIN [dbo].[T2] [t_T2] ON [t].[T2Id] = [t_T2].[Id]
Expected SQL:
SELECT
[t].[Id],
[t_T2].[Name]
FROM
[dbo].[T1] [t] WITH (NoLock)
LEFT JOIN [dbo].[T2] [t_T2] WITH (NoLock) ON [t].[T2Id] = [t_T2].[Id]
The text was updated successfully, but these errors were encountered:
I have complex model with many references.
When I use
TablesInScopeHint(SqlServerHints.Table.NoLock)
it only adds a hint for explicitly specified tables in the query but ignores references.Classes:
Query:
Result SQL:
Expected SQL:
The text was updated successfully, but these errors were encountered: