ardalis / ardalis/EFCore.Extensions

Add Extensions to Enable/Disable tracking on a DbContext

Open
#1 0 comments 0 reactions 0 assignees View on GitHub
good first issue
Dominant language
C#
Stars
44
Forks
8
PR merge metrics
No merged PRs in 30d

Description

If you want to force the dbContext to make a new db call instead of relying on its identity map, you can do so with this approach:

```
dbContext.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
var fromDb = await dbContext. [whatever query]
dbContext.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.TrackAll;
```

Create extension methods that simply turn off tracking and then turn it back on that require less code than assigning to the QueryTrackingBehavior does.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the existing extension methods and the DbContext tracking API used by this project. Add extensions that disable and restore tracking, then verify they provide the requested shorter equivalent to changing QueryTrackingBehavior around a query.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
database
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.