Last post Sep 06, 2018 04:03 PM by ARGH
Sep 01, 2018 06:31 AM|ARGH|LINK
Sep 01, 2018 11:03 AM|mgebhard|LINK
Optimistic concurrency works as outlined in the reference documentation.
I suggest that you create a test project according to the docs above. That will give you a known working example.
Try to apply the same to your project. If you are still having trouble and need assistance, post sample code that reproduces the behavior. That will help us help you troubleshoot the issue.
I've seen posts like this where optimistic concurrency is working but the test were flawed.
Sep 01, 2018 11:27 AM|DA924|LINK
Myself personally, I never fooled with concurrency with or without an ORM in using optimistic concurrency. I always use pessimistic concurrency that never fails.
Sep 01, 2018 02:55 PM|ARGH|LINK
Sep 01, 2018 03:09 PM|ARGH|LINK
Sep 01, 2018 08:23 PM|mgebhard|LINK
So you are asking the community to debug chapter 11?
How about simply reading the ASP Core doc linked in my first post as we know it works. Also, can you explain how you are testing?
Sep 06, 2018 03:12 AM|ARGH|LINK
no not at all! I removed it from my previous post as it probably made me look like a college student looking for answers, ha!
my testing is simply having 2 web browsers open and going into the edit menu of the same item on both browsers before any changes made. I make a change in one browser and then make a change in the other browser. the second change from the other browser
should be flagged for concurrency violation as the first browser already changed the item before it.
anyway, I believe I may have narrowed it down. I looked at the logging information that EF produces for the SQL. the concurrency tokens do work and EF is looking for concurrency as there are the appropriate WHERE clauses attached to the properties specified
during the UPDATE. the problem is that the EF is checking the current values in the database and not the original values. I assumed the concurrency check data annotation would handle this automatically for me. when I wrote concurrency in the update with
ADO.NET I fed the function 2 objects, one with original values and the other one with the proposed changes. in this design I am trying to implement the edit function in the controller only accepts the proposed object as an argument.
my problem is probably a simple one but being new to MVC and EF, as well as the repository pattern I am trying to grasp has me confused.
Sep 06, 2018 04:03 PM|ARGH|LINK
disregard. I found the solution. I need to re-do the edit function to accept another parameter with the object containing the original value.