Description
Onur Gumus created an issue — 12th August 2010, 8:06:30:
Hello, currently I can't see anyway to give database hints when using linq queries.
It would help us greatly if hints via SetLockMode (or any other way) can be added to linq queries.
Olag Ulga added a comment — 10th April 2013, 11:59:29:
This missing feature prevents the using of linq. Linq itself is the best way to write clean queries.
Onur Gumus added a comment — 11th April 2013, 8:39:07:
I worked to implement this feature and it seems a bit difficult. I implemented linq part it works perfectly fine till it has to make this call:
internal class ProcessLock : IResultOperatorProcessor
{
public void Process(LockResultOperator resultOperator, QueryModelVisitor queryModelVisitor, IntermediateHqlTree tree)
{
tree.AddAdditionalCriteria((q, p) => q.SetLockMode(<what_here?> ,(LockMode)resultOperator.LockMode.Value));
}
}Apperantly IQuery.SetLockMode asks for an alias to set lock mode. With linq query itself there is no alias available, passing null or empty string will not work either. so I am stuck at this point.
Onur Gumus added a comment — 11th April 2013, 9:59:50:
Ok I fixed it :) and sent a pull request #200
let's cross the fingers now
Shawn Debnath added a comment — 28th June 2013, 3:25:19:
Looks like this still hasn't been merged - any ideas when can we expect it?
Marco Casamento added a comment — 28th May 2014, 6:25:15:
Is the proposed solution functional ? It looks weird it hasn't been merged by 4 years
Onur Gumus added a comment — 28th May 2014, 6:34:44:
It's been waiting to merge for 1 years.
However, if you want alternatively, you can grab "NHibernateX" package from nuget. This pacakge is a fork of nhibernate that has locking and async support.
It is .NET 4.5.1 only though.
Ricardo Peres added a comment — 13th August 2014, 12:43:20:
Can this be merged?
Oskar Berggren added a comment — 17th August 2014, 11:31:17:
PR #200 isn't clean, it contains merge commits (happens because the PR is made from master and not from a clean topic branch). Scheduling for review for the next release. In the meantime, a new clean PR would be helpful.
Onur Gumus added a comment — 17th August 2014, 12:54:23:
I added #304 from scratch.
Now let's wait another 2 years for your feedback.
Oskar Berggren added a comment — 17th August 2014, 13:04:06:
Thanks for the pull request. Please respect that I and others are spending our evenings and weekends on this.
Onur Gumus added a comment — 20th September 2014, 7:27:26:
Why is this merge still waiting ? Am I missing something again ?
Oskar Berggren added a comment — 20th September 2014, 16:52:51:
It's scheduled for review for NH 4.1. We will (shortly) do 4.0.1 from the master branch before it opens for 4.1 merges,.
Ricardo Peres added a comment — 20th November 2014, 17:46:34:
Pull request included in issue NH-2140.
Oskar Berggren added a comment — 20th November 2016, 16:51:52:
Updated PR: #530
Alexander Zaytsev added a comment — 14th September 2017, 1:44:13:
Move new features to 5.1