querybuilder icon indicating copy to clipboard operation
querybuilder copied to clipboard

Add option of WITH (NOLOCK)

Open Shurpop opened this issue 3 years ago • 3 comments

Hello. SqlKata already has FromRaw method to allow write queries WITH (NOLOCK) operation but it's something needed to be fluent and doesn't need to write manually all the methods.

Maybe one suggestion could be add this option in the compiler similar to :

compiler = Compilers.Get<SqlServerCompiler>(EngineCodes.SqlServer); compiler.UseLegacyPagination = true;

But using a new property:

compiler = Compilers.Get<SqlServerCompiler>(EngineCodes.SqlServer); compiler.UseLegacyPagination = true; compiler.UseNoLock = true;

This functionality will be very helpful, in my current case in doing queries only for reporting so we don't want to block any record and also this data changes frequently.

Thanks for your great work!

Shurpop avatar Oct 08 '20 18:10 Shurpop

I accept @Shurpop and (Nolock) is very important for Sql server. Nowly i use it with FromRaw but its not good way. If change database to pg it will raise an error. So this compiler option have to be compiler based (sql server pg etc...)

SinavAhmet avatar Mar 29 '21 13:03 SinavAhmet

See my comment here.

asherber avatar Jun 22 '21 23:06 asherber

@ahmad-moussawi Any possibility of adding this feature in sqlkata? Would be really useful.

adhip94 avatar Jul 27 '21 15:07 adhip94