-
Notifications
You must be signed in to change notification settings - Fork 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 tracking.md #4298
Update tracking.md #4298
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but will let @ajcvickers approve as well.
Re changing 2nd-person ("you can do this") to impersonal ("this can be done"), I thought a more personal tone was OK/encouraged, we certainly use 2nd-person in many places in our docs.
|
||
You can combine both of the above behaviors in same query. That is, you can have a no tracking query, which will do identity resolution in the results. Just like `AsNoTracking()` queryable operator, we've added another operator `AsNoTrackingWithIdentityResolution()`. There's also associated entry added in the <xref:Microsoft.EntityFrameworkCore.QueryTrackingBehavior> enum. When you configure the query to use identity resolution with no tracking, we use a stand-alone change tracker in the background when generating query results so each instance is materialized only once. Since this change tracker is different from the one in the context, the results are not tracked by the context. After the query is enumerated fully, the change tracker goes out of scope and garbage collected as required. | ||
Tracking and no-tracking can be combined in the same query. That is, you can have a no-tracking query, which does identity resolution in the results. Just like `AsNoTracking` queryable operator, we've added another operator <xref:Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.AsNoTrackingWithIdentityResolution%60%601(System.Linq.IQueryable{%60%600})>. There's also associated entry added in the <xref:Microsoft.EntityFrameworkCore.QueryTrackingBehavior> enum. When the query to use identity resolution is configured with no tracking, a stand-alone change tracker is used in the background when generating query results so each instance is materialized only once. Since this change tracker is different from the one in the context, the results are not tracked by the context. After the query is enumerated fully, the change tracker goes out of scope and garbage collected as required. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably want to make other method names (AsNoTracking, AsTracking) xref links as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably want to make other method names (AsNoTracking, AsTracking) xref links as well
@roji please review this commit
Co-authored-by: Shay Rojansky <[email protected]>
Dan Roth had us use the more formal language when we started doc'ing ASP.NET Core. My strongest justification is the style guide mantra Shorter is always better. When a consultant is reading our docs to make recommendations to their client, your app, your code doesn't make sense. The shorter version always makes sense. |
|
||
> [!NOTE] | ||
> [Keyless entity types](xref:core/modeling/keyless-entity-types) are never tracked. Wherever this article mentions entity types, it refers to entity types which have a key defined. | ||
|
||
> [!TIP] | ||
> You can view this article's [sample](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Querying/Tracking) on GitHub. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMAO, too much bling can be distracting. I can revert.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR not passing checks.
Nothing to do with my changes Error: entity-framework/core/querying/tracking.md:82:1 MD004/ul-style Unordered list style [Expected: asterisk; Actual: dash] I'll fix these. |
Error: entity-framework/core/querying/tracking.md:82:1 MD004/ul-style Unordered list style [Expected: asterisk; Actual: dash]
Per MS style guide
()
from methodsUse bigger ideas, fewer words : Our modern design hinges on crisp minimalism. Shorter is always better.
Short sentences and fragments are easier to scan and read. Prune every excess word.
Contributes to dotnet/AspNetCore.Docs#23572