-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Update in-memory database to use optimistic offline lock for IsRowVersion concurrency #10625
Comments
Duplicate of #7210 |
Not sure about that, I mentioned IsRowVersion since they have similar behaviors, but this is about Concurrency token primarily. It looks like this should have been fixed in #10157. Not sure if that has shipped? |
@psibernetic That issue is in the 2.1 milestone and so the fix has not yet been shipped. You could try with our nightly builds--feeds listed on the repo homepage: https://github.com/aspnet/EntityFrameworkCore |
Leaving this open so we can revisit in triage whether to have an issue for IsRowVersion on in-memory. |
For anyone who stumbles across this issue, I confirmed |
this would seem to be incorrectly titled. it is actually about IsConcurrencyToken #10625 (comment) and the repro code does not use rowversion at all |
@SimonCropp Correct. The code doesn't match the issue that this is tracking. But the title is correct at least! :-) |
ok i am confused. can either the title or the repro be fixed so that they match, since from my perspective it seems that IsConcurrencyToken was conflated with row version which resulted in an incorrect title. ie "fixing" this issue based on the title will have no impact on the repro as described. |
The original issue was for both, neither worked at the time. My code showed IsConcurrencyCheck because I assumed that it was used by IsRowVersion. Not sure if that is true, but there was a larger issue with row version not being supported in the in-memory db. This issue now tracks the enablement of #2195 for the in-memory implementation I think. The repro code is no longer applicable. Should probably spin up a new issue owned by the team and reference this one. |
@psibernetic thanks for the clarification. the reason i am asking is that i am using in-memory heavily for testing, and i find some of the pieces it doesnt currently implement to be desirable. So i created a "in memory feature polyfill" (for lack of a better term) https://github.com/SimonCropp/EfCore.InMemoryHelpers for the issues it fixes/implements, i want to track those issues, and remove the specific code related to them as they are fixed. |
Very nice, thanks for sharing! |
The sample for Razor Pages with EF Core in ASP.NET Core - Concurrency, code at https://github.com/dotnet/AspNetCore.Docs/tree/main/aspnetcore/data/ef-rp/intro/samples/cu50 reproduces the problem with the in-memory provider. See Optional: Build the sample download and change public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddRazorPages();
#if !IN_MEM
services.AddDbContext<SchoolContext>(options =>
options.UseSqlite(Configuration.GetConnectionString("SchoolContext")));
#else
services.AddDbContext<SchoolContext>(options =>
options.UseInMemoryDatabase("SchoolContext"));
#endif
services.AddDatabaseDeveloperPageExceptionFilter();
} |
We recommend against using the in-memory provider for testing--see Testing EF Core Applications. While we have no plans to remove the in-memory provider, we will not be adding any new features to this provider because we believe valuable development time is better spent in other areas. When feasible, we plan to still fix regressions in existing behavior. |
The original issue here was about support for in the in-memory database for both:
As of the 2.1 release, the first of these is now implemented. This issue remains open to track implementation of the second.
Original issue:
InMemory provider does not appear to respect ConcurrencyCheck or RowVersion.
Steps to reproduce
This fails with the following output:
Furthermore, if I bypass the
Assert.ThrowsAsync
the Counter is 1, so the update set the counter to 1 four times.Further technical details
EF Core version: 2.0.1
Database Provider: (e.g. Microsoft.EntityFrameworkCore.InMemory) 2.0.1
Operating system: Windows 10 x64 build 17075 -pre
IDE: (e.g. Visual Studio 2017 15.5.2)
The text was updated successfully, but these errors were encountered: