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
How can i add table hint for each join?
var query = new Query().FromRaw("Users with (nolock)")
.Join("Authors", "Authors.Id", "Posts.AuthorId")
.Where("Id", 1)
.Where("Status", "Active");
will be:
SELECT * FROM Users with (nolock)
INNER JOIN [Authors] ON [Authors].[Id] = [Posts].[AuthorId]
WHERE [Id] = 1 AND [Status] = 'Active'
but I want it to be:
SELECT * FROM Users with (nolock)
INNER JOIN [Authors] with (nolock) ON [Authors].[Id] = [Posts].[AuthorId]
WHERE [Id] = 1 AND [Status] = 'Active'
The text was updated successfully, but these errors were encountered:
I had the same issue and tackled it by implementing my own compiler.
classNoLockCompiler:SqlServerCompiler{publicoverridestringCompileTableExpression(SqlResultctx,AbstractFromfrom){returnbase.CompileTableExpression(ctx,from)+" WITH (NOLOCK)";}}/*var q = new Query("foo") .Join("bar as baz", "a", "b");SELECT * FROM [foo] WITH (NOLOCK) INNER JOIN [bar] as [baz] WITH (NOLOCK) ON [a] = [b]*/
It might be nice if SqlServerCompiler had a boolean property to enable this behavior out of the box.
How can i add table hint for each join?
var query = new Query().FromRaw("Users with (nolock)")
.Join("Authors", "Authors.Id", "Posts.AuthorId")
.Where("Id", 1)
.Where("Status", "Active");
will be:
SELECT * FROM Users with (nolock)
INNER JOIN [Authors] ON [Authors].[Id] = [Posts].[AuthorId]
WHERE [Id] = 1 AND [Status] = 'Active'
but I want it to be:
SELECT * FROM Users with (nolock)
INNER JOIN [Authors] with (nolock) ON [Authors].[Id] = [Posts].[AuthorId]
WHERE [Id] = 1 AND [Status] = 'Active'
The text was updated successfully, but these errors were encountered: