I want to use SaveChangesAsync after calling the UpdateRevision method.
On Marten solution, in numeric_revisioning.cs test files, for the public async Task optimistic_concurrency_failure_with_update_revision()
If I change the SaveChanges() to use SaveChangesAsync() it throws a Marten.Exceptions.ConcurrencyException.
The tests with UpdateRevision seem to fail when used with SaveChangesAsync();
[Fact]
public async Task optimistic_concurrency_failure_with_update_revision()
{
var doc1 = new RevisionedDoc { Name = "Tim" };
theSession.Store(doc1);
theSession.SaveChanges();
doc1.Name = "Bill";
theSession.Store(doc1);
theSession.SaveChanges();
doc1.Name = "Dru";
theSession.Store(doc1);
theSession.SaveChanges();
var doc2 = new RevisionedDoc { Id = doc1.Id, Name = "Wrong" };
theSession.UpdateRevision(doc2, doc1.Version + 1);
await theSession.SaveChangesAsync();
theSession.Logger = new TestOutputMartenLogger(_output);
await Should.ThrowAsync<ConcurrencyException>(async () =>
{
theSession.UpdateRevision(doc2, 2);
theSession.SaveChanges();
});
}
Stack Trace:
AutoClosingLifetime.ExecuteBatchPagesAsync(IReadOnlyList1 pages, List1 exceptions, CancellationToken token) line 347
AutoClosingLifetime.ExecuteBatchPagesAsync(IReadOnlyList1 pages, List1 exceptions, CancellationToken token) line 369
AutoClosingLifetime.ExecuteBatchPagesAsync(IReadOnlyList1 pages, List1 exceptions, CancellationToken token) line 369
<b__2_0>d.MoveNext()
--- End of stack trace from previous location ---
Outcome1.GetResultOrRethrow() ResiliencePipeline.ExecuteAsync[TState](Func3 callback, TState state, CancellationToken cancellationToken)
DocumentSessionBase.ExecuteBatchAsync(IUpdateBatch batch, CancellationToken token) line 192
ExceptionTransformExtensions.TransformAndThrow(IEnumerable`1 transforms, Exception ex)
DocumentSessionBase.ExecuteBatchAsync(IUpdateBatch batch, CancellationToken token) line 199
DocumentSessionBase.ExecuteBatchAsync(IUpdateBatch batch, CancellationToken token) line 216
DocumentSessionBase.SaveChangesAsync(CancellationToken token) line 99
numeric_revisioning.optimistic_concurrency_failure_with_update_revision() line 173
--- End of stack trace from previous location ---
I want to use SaveChangesAsync after calling the UpdateRevision method.
On Marten solution, in numeric_revisioning.cs test files, for the
public async Task optimistic_concurrency_failure_with_update_revision()
If I change theSaveChanges(
) to useSaveChangesAsync()
it throws a Marten.Exceptions.ConcurrencyException. The tests withUpdateRevision
seem to fail when used withSaveChangesAsync()
;Stack Trace: AutoClosingLifetime.ExecuteBatchPagesAsync(IReadOnlyListb__2_0>d.MoveNext()
--- End of stack trace from previous location ---
Outcome
1 pages, List
1 exceptions, CancellationToken token) line 347 AutoClosingLifetime.ExecuteBatchPagesAsync(IReadOnlyList1 pages, List
1 exceptions, CancellationToken token) line 369 AutoClosingLifetime.ExecuteBatchPagesAsync(IReadOnlyList1 pages, List
1 exceptions, CancellationToken token) line 369 <1.GetResultOrRethrow() ResiliencePipeline.ExecuteAsync[TState](Func
3 callback, TState state, CancellationToken cancellationToken) DocumentSessionBase.ExecuteBatchAsync(IUpdateBatch batch, CancellationToken token) line 192 ExceptionTransformExtensions.TransformAndThrow(IEnumerable`1 transforms, Exception ex) DocumentSessionBase.ExecuteBatchAsync(IUpdateBatch batch, CancellationToken token) line 199 DocumentSessionBase.ExecuteBatchAsync(IUpdateBatch batch, CancellationToken token) line 216 DocumentSessionBase.SaveChangesAsync(CancellationToken token) line 99 numeric_revisioning.optimistic_concurrency_failure_with_update_revision() line 173 --- End of stack trace from previous location ---