-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[5.0.2] Handle concurrency tokens with conversions in the in-memory d…
…atabase Fixes #23527 Also fixes #12436 (MQ issue to add more testing for ulong concurrency tokes) The fix is to ensure the current value is converted to the model type before comparing.
- Loading branch information
1 parent
bcaff08
commit 68cb20b
Showing
14 changed files
with
237 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,28 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using Microsoft.EntityFrameworkCore.Diagnostics; | ||
using Microsoft.EntityFrameworkCore.TestUtilities; | ||
|
||
namespace Microsoft.EntityFrameworkCore | ||
{ | ||
public class F1InMemoryFixture : F1FixtureBase | ||
public class F1InMemoryFixture : F1InMemoryFixtureBase<byte[]> | ||
{ | ||
} | ||
|
||
public class F1ULongInMemoryFixture : F1InMemoryFixtureBase<ulong> | ||
{ | ||
} | ||
|
||
public abstract class F1InMemoryFixtureBase<TRowVersion> : F1FixtureBase<TRowVersion> | ||
{ | ||
public override TestHelpers TestHelpers | ||
=> InMemoryTestHelpers.Instance; | ||
|
||
protected override ITestStoreFactory TestStoreFactory | ||
=> InMemoryTestStoreFactory.Instance; | ||
|
||
public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) | ||
=> base.AddOptions(builder).ConfigureWarnings(e => e.Ignore(InMemoryEventId.TransactionIgnoredWarning)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
test/EFCore.InMemory.FunctionalTests/OptimisticConcurrencyInMemoryTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Threading.Tasks; | ||
using Xunit; | ||
|
||
namespace Microsoft.EntityFrameworkCore | ||
{ | ||
public class OptimisticConcurrencyULongInMemoryTest : OptimisticConcurrencyInMemoryTestBase<F1ULongInMemoryFixture, ulong> | ||
{ | ||
public OptimisticConcurrencyULongInMemoryTest(F1ULongInMemoryFixture fixture) | ||
: base(fixture) | ||
{ | ||
} | ||
} | ||
|
||
public class OptimisticConcurrencyInMemoryTest : OptimisticConcurrencyInMemoryTestBase<F1InMemoryFixture, byte[]> | ||
{ | ||
public OptimisticConcurrencyInMemoryTest(F1InMemoryFixture fixture) | ||
: base(fixture) | ||
{ | ||
} | ||
} | ||
|
||
public abstract class OptimisticConcurrencyInMemoryTestBase<TFixture, TRowVersion> | ||
: OptimisticConcurrencyTestBase<TFixture, TRowVersion> | ||
where TFixture : F1FixtureBase<TRowVersion>, new() | ||
{ | ||
protected OptimisticConcurrencyInMemoryTestBase(TFixture fixture) | ||
: base(fixture) | ||
{ | ||
} | ||
|
||
[ConditionalFact(Skip = "Optimistic Offline Lock #2195")] | ||
public override Task Simple_concurrency_exception_can_be_resolved_with_store_values() | ||
=> Task.FromResult(true); | ||
|
||
[ConditionalFact(Skip = "Optimistic Offline Lock #2195")] | ||
public override Task Simple_concurrency_exception_can_be_resolved_with_client_values() | ||
=> Task.FromResult(true); | ||
|
||
[ConditionalFact(Skip = "Optimistic Offline Lock #2195")] | ||
public override Task Simple_concurrency_exception_can_be_resolved_with_new_values() | ||
=> Task.FromResult(true); | ||
|
||
[ConditionalFact(Skip = "Optimistic Offline Lock #2195")] | ||
public override Task Simple_concurrency_exception_can_be_resolved_with_store_values_using_equivalent_of_accept_changes() | ||
=> Task.FromResult(true); | ||
|
||
[ConditionalFact(Skip = "Optimistic Offline Lock #2195")] | ||
public override Task Simple_concurrency_exception_can_be_resolved_with_store_values_using_Reload() | ||
=> Task.FromResult(true); | ||
|
||
[ConditionalFact(Skip = "Optimistic Offline Lock #2195")] | ||
public override Task Updating_then_deleting_the_same_entity_results_in_DbUpdateConcurrencyException() | ||
=> Task.FromResult(true); | ||
|
||
[ConditionalFact(Skip = "Optimistic Offline Lock #2195")] | ||
public override Task | ||
Updating_then_deleting_the_same_entity_results_in_DbUpdateConcurrencyException_which_can_be_resolved_with_store_values() | ||
=> Task.FromResult(true); | ||
|
||
[ConditionalFact(Skip = "Optimistic Offline Lock #2195")] | ||
public override Task | ||
Change_in_independent_association_after_change_in_different_concurrency_token_results_in_independent_association_exception() | ||
=> Task.FromResult(true); | ||
|
||
[ConditionalFact(Skip = "Optimistic Offline Lock #2195")] | ||
public override Task Change_in_independent_association_results_in_independent_association_exception() | ||
=> Task.FromResult(true); | ||
|
||
[ConditionalFact(Skip = "Optimistic Offline Lock #2195")] | ||
public override Task Two_concurrency_issues_in_one_to_many_related_entities_can_be_handled_by_dealing_with_dependent_first() | ||
=> Task.FromResult(true); | ||
|
||
[ConditionalFact(Skip = "Optimistic Offline Lock #2195")] | ||
public override Task Two_concurrency_issues_in_one_to_one_related_entities_can_be_handled_by_dealing_with_dependent_first() | ||
=> Task.FromResult(true); | ||
|
||
[ConditionalFact(Skip = "Throw DbUpdateException or DbUpdateConcurrencyException for in-memory database errors #23569")] | ||
public override Task Adding_the_same_entity_twice_results_in_DbUpdateException() | ||
=> Task.FromResult(true); | ||
|
||
[ConditionalFact(Skip = "Throw DbUpdateException or DbUpdateConcurrencyException for in-memory database errors #23569")] | ||
public override Task Deleting_the_same_entity_twice_results_in_DbUpdateConcurrencyException() | ||
=> Task.FromResult(true); | ||
|
||
[ConditionalFact(Skip = "Throw DbUpdateException or DbUpdateConcurrencyException for in-memory database errors #23569")] | ||
public override Task Deleting_then_updating_the_same_entity_results_in_DbUpdateConcurrencyException() | ||
=> Task.FromResult(true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.