dotnet / dotnet/efcore

UseTransaction() operator to automatically execute a query in a specific isolation level (e.g. split query)

Open
#34,724 4 comments 1 reaction 0 assignees View on GitHub
area-query customer-reported
Dominant language
C#
Stars
14.8k
Forks
3.4k
PR merge metrics
PR metrics pending

Description

I'm facing with something related to #33826. We are trying to adopt RCSI and Snapshot Isolation with specific cases.

Is there any quick extension method to wrap executed query in specified transaction with isolation level?

Something like this:
``` c#

// We have enabled READ_COMMITTED_SNAPSHOT Isolation

await _db.Table1
.UseTransaction(IsolationLevel.Snapshot)
.AsSplitQuery()
.Include(x => x.Table2)
.Include(x => x.Table3)
.Include(x => x.Table4).ThenInclude(x => x.Table4_1)
.Include(x => x.Table5)
.Where(...)
.ToListAsync(...);

```

Or maybe I could add this by some interceptor but i do now know which one?

UPDATE
@roji Overall, the idea behind this #30353 task isn't that bad? 😃

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.