You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: entity-framework/core/change-tracking/change-detection.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -179,7 +179,7 @@ The performance of detecting changes is not a bottleneck for most applications.
179
179
As we know from the previous section, both <xref:Microsoft.EntityFrameworkCore.ChangeTracking.ChangeTracker.Entries%60%601?displayProperty=nameWithType> and <xref:Microsoft.EntityFrameworkCore.DbContext.SaveChanges%2A?displayProperty=nameWithType> automatically detect changes. However, after calling Entries, the code does not then make any entity or property state changes. (Setting normal property values on Added entities does not cause any state changes.) The code therefore disables unnecessary automatic change detection when calling down into the base SaveChanges method. The code also makes use of a try/finally block to ensure that the default setting is restored even if SaveChanges fails.
180
180
181
181
> [!TIP]
182
-
> Do not assume that your code must disable automatic change detection to to perform well. This is only needed when profiling an application tracking many entities indicates that performance of change detection is an issue.
182
+
> Do not assume that your code must disable automatic change detection to perform well. This is only needed when profiling an application tracking many entities indicates that performance of change detection is an issue.
183
183
184
184
### Detecting changes and value conversions
185
185
@@ -234,7 +234,7 @@ Notification entities make use of the <xref:System.ComponentModel.INotifyPropert
In addition, any collection navigations must implement `INotifyCollectionChanged`; in the example above this satisfied by using an <xref:System.Collections.ObjectModel.ObservableCollection%601> of posts. EF Core also ships with an <xref:Microsoft.EntityFrameworkCore.ChangeTracking.ObservableHashSet%601> implementation that has more efficient lookups at the expense of stable ordering.
237
+
In addition, any collection navigations must implement `INotifyCollectionChanged`; in the example above this is satisfied by using an <xref:System.Collections.ObjectModel.ObservableCollection%601> of posts. EF Core also ships with an <xref:Microsoft.EntityFrameworkCore.ChangeTracking.ObservableHashSet%601> implementation that has more efficient lookups at the expense of stable ordering.
238
238
239
239
Most of this notification code is typically moved into an unmapped base class. For example:
240
240
@@ -297,7 +297,7 @@ Instead, EF Core must be configured to use these notification entities. This is
297
297
298
298
Full notification change tracking requires that both `INotifyPropertyChanging` and `INotifyPropertyChanged` are implemented. This allows original values to be saved just before the property value is changed, avoiding the need for EF Core to create a snapshot when tracking the entity. Entity types that implement only `INotifyPropertyChanged` can also be used with EF Core. In this case, EF still creates a snapshot when tracking an entity to keep track of original values, but then uses the notifications to detect changes immediately, rather than needing DetectChanges to be called.
299
299
300
-
The different <xref:Microsoft.EntityFrameworkCore.ChangeTrackingStrategy> values are summarized in the the following table.
300
+
The different <xref:Microsoft.EntityFrameworkCore.ChangeTrackingStrategy> values are summarized in the following table.
Copy file name to clipboardexpand all lines: entity-framework/core/change-tracking/explicit-tracking.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ Entities can be explicitly "attached" to a <xref:Microsoft.EntityFrameworkCore.D
28
28
1. Creating new entities that will be inserted into the database.
29
29
2. Re-attaching disconnected entities that were previously queried by a _different_ DbContext instance.
30
30
31
-
The first of these will be needed by most applications, and is primary handled by the <xref:Microsoft.EntityFrameworkCore.DbContext.Add%2A?displayProperty=nameWithType> methods.
31
+
The first of these will be needed by most applications, and is primarily handled by the <xref:Microsoft.EntityFrameworkCore.DbContext.Add%2A?displayProperty=nameWithType> methods.
32
32
33
33
The second is only needed by applications that change entities or their relationships **_while the entities are not being tracked_**. For example, a web application may send entities to the web client where the user makes changes and sends the entities back. These entities are referred to as "disconnected" since they were originally queried from a DbContext, but were then disconnected from that context when sent to the client.
34
34
@@ -462,7 +462,7 @@ The important point to notice here is that, with generated key values, EF Core i
462
462
463
463
### Explicit key values
464
464
465
-
<xref:Microsoft.EntityFrameworkCore.DbContext.Update%2A?displayProperty=nameWithType>, <xref:Microsoft.EntityFrameworkCore.DbContext.UpdateRange%2A?displayProperty=nameWithType>, and the equivalent methods on <xref:Microsoft.EntityFrameworkCore.DbSet%601> behave exactly as the `Attach` methods described above, except that entities are put into the `Modfied` instead of the `Unchanged` state. For example, to start tracking an existing blog as `Modified`:
465
+
<xref:Microsoft.EntityFrameworkCore.DbContext.Update%2A?displayProperty=nameWithType>, <xref:Microsoft.EntityFrameworkCore.DbContext.UpdateRange%2A?displayProperty=nameWithType>, and the equivalent methods on <xref:Microsoft.EntityFrameworkCore.DbSet%601> behave exactly as the `Attach` methods described above, except that entities are put into the `Modified` instead of the `Unchanged` state. For example, to start tracking an existing blog as `Modified`:
466
466
467
467
<!--
468
468
context.Update(
@@ -678,7 +678,7 @@ It is unusual to call `Remove` on an entity created with `new`. Further, unlike
678
678
1. Running a query for the entities
679
679
2. Using the `Attach` or `Update` methods on a graph of disconnected entities, as described in the preceding sections.
680
680
681
-
For example, the code in the previous section is more likely obtain a post from a client and then do something like this:
681
+
For example, the code in the previous section is more likely to obtain a post from a client and then do something like this:
682
682
683
683
<!--
684
684
context.Attach(post);
@@ -753,7 +753,7 @@ In the preceding examples we were deleting a post, which is a dependent/child en
753
753
This invalid model state can be handled in two ways:
754
754
755
755
1. Setting FK values to null. This indicates that the dependents/children are no longer related to any principal/parent. This is the default for optional relationships where the foreign key must be nullable. Setting the FK to null is not valid for required relationships, where the foreign key is typically non-nullable.
756
-
2. Deleting the the dependents/children. This is the default for required relationships, and is also valid for optional relationships.
756
+
2. Deleting the dependents/children. This is the default for required relationships, and is also valid for optional relationships.
757
757
758
758
See [Changing Foreign Keys and Navigations](xref:core/change-tracking/relationship-changes) for detailed information on change tracking and relationships.
Copy file name to clipboardexpand all lines: entity-framework/core/logging-events-diagnostics/interceptors.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -64,7 +64,7 @@ Low-level database interception is split into the three interfaces shown in the
64
64
65
65
The base classes <xref:Microsoft.EntityFrameworkCore.Diagnostics.DbCommandInterceptor>, <xref:Microsoft.EntityFrameworkCore.Diagnostics.DbConnectionInterceptor>, and <xref:Microsoft.EntityFrameworkCore.Diagnostics.DbTransactionInterceptor> contain no-op implementations for each method in the corresponding interface. Use the base classes to avoid the need to implement unused interception methods.
66
66
67
-
The methods on each interceptor type come in pairs, with the first being called before the database operation is started, and the second after the operation has completed. For example. For example, <xref:Microsoft.EntityFrameworkCore.Diagnostics.DbCommandInterceptor.ReaderExecuting%2A?displayProperty=nameWithType> is called before a query is executed, and <xref:Microsoft.EntityFrameworkCore.Diagnostics.DbCommandInterceptor.ReaderExecuted%2A?displayProperty=nameWithType> is called after query has been sent to the database.
67
+
The methods on each interceptor type come in pairs, with the first being called before the database operation is started, and the second after the operation has completed. For example, <xref:Microsoft.EntityFrameworkCore.Diagnostics.DbCommandInterceptor.ReaderExecuting%2A?displayProperty=nameWithType> is called before a query is executed, and <xref:Microsoft.EntityFrameworkCore.Diagnostics.DbCommandInterceptor.ReaderExecuted%2A?displayProperty=nameWithType> is called after query has been sent to the database.
68
68
69
69
Each pair of methods have both sync and async variations. This allows for asynchronous I/O, such as requesting an access token, to happen as part of intercepting an async database operation.
70
70
@@ -257,7 +257,7 @@ This interceptor also manipulates the command text. This manipulation is not req
257
257
258
258
#### After execution
259
259
260
-
If no cached message is available, or if it has expired, then the code above does not suppress the result. EF Core will therefore execute the query as normal. It will then return to the interceptor's `Executed` method after execution. At this point if the result is not already a cached reader, then the new message ID and string is exacted from the real reader and cached ready for the next use of this query.
260
+
If no cached message is available, or if it has expired, then the code above does not suppress the result. EF Core will therefore execute the query as normal. It will then return to the interceptor's `Executed` method after execution. At this point if the result is not already a cached reader, then the new message ID and string is extracted from the real reader and cached ready for the next use of this query.
261
261
262
262
<!--
263
263
public override async ValueTask<DbDataReader> ReaderExecutedAsync(
Other flags in <xref:Microsoft.EntityFrameworkCore.Diagnostics.DbContextLoggerOptions> can be used to trim down the amount of metadata included in the log. This is can be useful in conjunction with single-line logging. For example:
314
+
Other flags in <xref:Microsoft.EntityFrameworkCore.Diagnostics.DbContextLoggerOptions> can be used to trim down the amount of metadata included in the log. This can be useful in conjunction with single-line logging. For example:
Copy file name to clipboardexpand all lines: entity-framework/core/what-is-new/ef-core-5.0/whatsnew.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -219,7 +219,7 @@ These entities can then be queried and updated just like normal entity types wit
219
219
220
220
In EF Core 3.1, the dependent end of a one-to-one relationship was always considered optional. This was most apparent when using owned entities, as all the owned entity's column were created as nullable in the database, even if they were configured as required in the model.
221
221
222
-
In EF Core 5.0, a navigation to an owned entity can be configured as as a required dependent. For example:
222
+
In EF Core 5.0, a navigation to an owned entity can be configured as a required dependent. For example:
Copy file name to clipboardexpand all lines: entity-framework/ef6/fundamentals/connection-resiliency/commit-failures.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -42,9 +42,9 @@ When the feature is enabled, EF will automatically add a new table to the databa
42
42
43
43
Although EF will do a best effort to prune rows from the table when they aren’t needed anymore, the table can grow if the application exits prematurely and for that reason you may need to purge the table manually in some cases.
44
44
45
-
## How to handle commit failures with previous Versions
45
+
## How to handle commit failures with previous versions
46
46
47
-
Before EF 6.1 there was not mechanism to handle commit failures in the EF product. There are several ways to dealing with this situation that can be applied to previous versions of EF6:
47
+
Before EF 6.1 there was no mechanism to handle commit failures in the EF product. There are several ways to dealing with this situation that can be applied to previous versions of EF6:
Copy file name to clipboardexpand all lines: entity-framework/ef6/fundamentals/connection-resiliency/retry-logic.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -63,7 +63,7 @@ The SqlAzureExecutionStrategy will retry instantly the first time a transient fa
63
63
64
64
The execution strategies will only retry a limited number of exceptions that are usually transient, you will still need to handle other errors as well as catching the RetryLimitExceeded exception for the case where an error is not transient or takes too long to resolve itself.
65
65
66
-
There are some known of limitations when using a retrying execution strategy:
66
+
There are some known limitations when using a retrying execution strategy:
Copy file name to clipboardexpand all lines: entity-framework/ef6/fundamentals/logging-and-interception.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -260,7 +260,7 @@ Looking at the methods defined on any of the interceptor interfaces it is appare
260
260
261
261
### Result handling
262
262
263
-
The DbCommandInterceptionContext\<\> class contains a properties called Result, OriginalResult, Exception, and OriginalException. These properties are set to null/zero for calls to the interception methods that are called before the operation is executed — that is, for the …Executing methods. If the operation is executed and succeeds, then Result and OriginalResult are set to the result of the operation. These values can then be observed in the interception methods that are called after the operation has executed — that is, on the …Executed methods. Likewise, if the operation throws, then the Exception and OriginalException properties will be set.
263
+
The DbCommandInterceptionContext\<\> class contains properties called Result, OriginalResult, Exception, and OriginalException. These properties are set to null/zero for calls to the interception methods that are called before the operation is executed — that is, for the …Executing methods. If the operation is executed and succeeds, then Result and OriginalResult are set to the result of the operation. These values can then be observed in the interception methods that are called after the operation has executed — that is, on the …Executed methods. Likewise, if the operation throws, then the Exception and OriginalException properties will be set.
Copy file name to clipboardexpand all lines: entity-framework/ef6/fundamentals/providers/index.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -88,6 +88,6 @@ If the provider is available for previous versions of EF, then we encourage you
88
88
89
89
## Can I write a provider myself?
90
90
91
-
It is certainly possible to create an EF provider yourself although it should not be considered a trivial undertaking. The the link above about the EF6 provider model is a good place to start. You may also find it useful to use the code for the SQL Server and SQL CE provider included in the [EF open source codebase](https://github.com/aspnet/EntityFramework6) as a starting point or for reference.
91
+
It is certainly possible to create an EF provider yourself although it should not be considered a trivial undertaking. The link above about the EF6 provider model is a good place to start. You may also find it useful to use the code for the SQL Server and SQL CE provider included in the [EF open source codebase](https://github.com/aspnet/EntityFramework6) as a starting point or for reference.
92
92
93
93
Note that starting with EF6 the EF provider is less tightly coupled to the underlying ADO.NET provider. This makes it easier to write an EF provider without needing to write or wrap the ADO.NET classes.
0 commit comments