-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Nolocking mechanism implemented for #1637 #1823
Conversation
Thank you @osoykan I'll review it. |
{ | ||
using (nolockInterceptor.Object.UseNolocking()) | ||
{ | ||
result = queryable(repository.GetAll()); |
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.
@osoykan is that working? I'm asking because Queryable is executed deferred (after nolockInterceptor.Object.UseNolocking()
is disposed). Have you tested this PR with a real database?
Thanks.
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.
If we return again IQueryable from Nolocking
, yes you are right, but we need to write executer methods in Nolocking
Also, I tried before and currently using in production but not abp based source code.
For example:
Person person = _personRepository.Nolocking(persons => persons.FirstOrDefault(x => x.Name == "halil"));
FirstOrDefault
forces Quearyable to execute on result = queryable(repository.GetAll());
statement. Actually user should provide executer methods like FirstOrDefault, ToList(), Count() etc...
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.
OK, that's good. Thank you for explanation.
@hikalkan, no problem, seems okay. But I was wondering, why did you use lock object? |
For unit tests. DbInterception.Add is a static method and unit tests can run in parallel. So, we should call DbInterception.Add only one time and in a thread safe way. |
* Nolocking extensions implemented for aspnetboilerplate#1637 * Add EfCoreTransactionStrategy * Implement EfCoreTransactionStrategy * Abp.Dapper package implemented for aspnetboilerplate#1661 * Dapper packoptions added on project.json * Abp.Dapper tests added * refactor for aspnetboilerplate#1661 * resolved aspnetboilerplate#1907 * Resolved aspnetboilerplate#1847: Trigger AbpHandledExceptionData for hangfire jobs too. * Fixed aspnetboilerplate#1875: Tenant Resolve Contributer renamed to Contributor (typo fix) * Resolved aspnetboilerplate#1886: Make TestAbpSession methods and properties virtual to allow overriding. * Use existing connection in the demo if available for EF Core. * aspnetboilerplate#1909: Refactor EF Core transaction strategy. Pass conn string to options builder. * aspnetboilerplate#1909 refactored DbContextEfCoreTransactionStrategy * aspnetboilerplate#1854 Correct version in project.json for dapper package. * Add Abp.Dapper to pack.ps1. * Resolved aspnetboilerplate#1827: Depend on JetBrains.Annotations instead of including annotations in Abp package. * Resolved aspnetboilerplate#1864: Set Http Status to 400 for validation exceptions. * Add WithNoLockInterceptor in AbpEntityFrameworkModule aspnetboilerplate#1823. * Resolved aspnetboilerplate#1892: Load plugin dependencies from plugin folder. * Incremented version to 1.5.0.0. * Resolved aspnetboilerplate#1915: Upgrade to AspNet Core v1.1.1. * Open solution on VS 2017, make it building (but not passing all unit tests yet). * Upgraded xunt and other nuget packages. * Create nuget packages after build. * Create Abp-fa.xml * Added bindings based on microsoft/vstest#428 to be able to run unit tests for aspnet core. * Passed all unit tests by applying microsoft/vstest#428 * Remove solution folder. * Change pack.ps1 for msbuild * Revised nuget packaging. * Fix appveyor.xml. * Move common project properties to a single file. Revise pack.ps1. * Change sln format. * update appveyor file * added RuntimeIdentifier. * Fix test dll paths in appveyor.xml * Temporarily remove NH tests for appveyor. * Check matched count on DomainTenantResolveContributor * Fixed aspnetboilerplate#1928: Fix Dapper namespaces. * Fix default namespaces for projects. * Resolved aspnetboilerplate#1934: Upgrade nuget package dependencies. * Fixed aspnetboilerplate#1923: Web API [DontWrapResult] Not Working with [AbpApiAuthorize] * Fixed aspnetboilerplate#1918: Can not handle model binding validation errors for dynamic web API actions. * aspnetboilerplate#1936 Remove Abp dependency from Abp.Web.Resources package. * Fixed aspnetboilerplate#1936: Abp.Web.Resources contents become flat with 1.5.1 release.
I implemented With Nolock interception for select queries on Repository level. I wrote test, but Effort does not generate Sql statements while interception time, so i tested local sql server on my computer and it works.
If you have a chance to review would be great!
Thanks in advance.