forked from dotnet/efcore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQueryTrackingBehavior.cs
More file actions
60 lines (55 loc) · 3.03 KB
/
Copy pathQueryTrackingBehavior.cs
File metadata and controls
60 lines (55 loc) · 3.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// 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.ChangeTracking;
#nullable enable
namespace Microsoft.EntityFrameworkCore
{
/// <summary>
/// Indicates how the results of a query are tracked by the <see cref="ChangeTracker" />.
/// </summary>
public enum QueryTrackingBehavior
{
/// <summary>
/// The change tracker will keep track of changes for all entities that are returned from a LINQ query.
/// Any modification to the entity instances will be detected and persisted to the database during
/// <see cref="DbContext.SaveChanges()" />.
/// </summary>
TrackAll = 0,
/// <summary>
/// <para>
/// The change tracker will not track any of the entities that are returned from a LINQ query. If the
/// entity instances are modified, this will not be detected by the change tracker and
/// <see cref="DbContext.SaveChanges()" /> will not persist those changes to the database.
/// </para>
/// <para>
/// Disabling change tracking is useful for read-only scenarios because it avoids the overhead of setting
/// up change tracking for each entity instance. You should not disable change tracking if you want to
/// manipulate entity instances and persist those changes to the database using
/// <see cref="DbContext.SaveChanges()" />.
/// </para>
/// <para>
/// Identity resolution will not be performed. If an entity with a given key is in different result in the result set
/// then they will be different instances.
/// </para>
/// </summary>
NoTracking,
/// <summary>
/// <para>
/// The change tracker will not track any of the entities that are returned from a LINQ query. If the
/// entity instances are modified, this will not be detected by the change tracker and
/// <see cref="DbContext.SaveChanges()" /> will not persist those changes to the database.
/// </para>
/// <para>
/// Disabling change tracking is useful for read-only scenarios because it avoids the overhead of setting
/// up change tracking for each entity instance. You should not disable change tracking if you want to
/// manipulate entity instances and persist those changes to the database using
/// <see cref="DbContext.SaveChanges()" />.
/// </para>
/// <para>
/// Identity resolution will be performed to ensure that all occurrences of an entity with a given key
/// in the result set are represented by the same entity instance.
/// </para>
/// </summary>
NoTrackingWithIdentityResolution
}
}