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
* The `DbSet` informs EF Core what C# entities should be mapped to the database.
78
-
* There are a variety of ways to configure the EF Core `DbContext`. You can read about them in: [Configuring a DbContext](/ef/core/miscellaneous/configuring-dbcontext).
78
+
* There are a variety of ways to configure the EF Core `DbContext`. You can read about them in: [Configuring a DbContext](xref:core/miscellaneous/configuring-dbcontext).
79
79
* This example uses the `OnConfiguring` override to specify a Sqlite data file.
80
80
* The `UseLazyLoadingProxies` call tells EF Core to implement lazy-loading, so child entities are automatically loaded when accessed from the parent.
81
81
82
82
Press **CTRL+SHIFT+B** or navigate to **Build > Build Solution** to compile the project.
83
83
84
84
> [!TIP]
85
-
> Learn about the different was to keep your database and EF Core models in sync: [Managing Database Schemas](/ef/core/managing-schemas).
85
+
> Learn about the different was to keep your database and EF Core models in sync: [Managing Database Schemas](xref:core/managing-schemas/index).
86
86
87
87
## Lazy Loading
88
88
@@ -143,7 +143,7 @@ The code declares a long-running instance of `ProductContext`. The `ProductConte
> The code uses a call to `EnsureCreated()` to build the database on the first run. This is acceptable for demos, but in production apps you should look at [migrations](/ef/core/managing-schemas/migrations/) to manage your schema. The code also executes synchronously because it uses a local SQLite database. For production scenarios that typically involve a remote server, consider using the asynchronous versions of the `Load` and `SaveChanges` methods.
146
+
> The code uses a call to `EnsureCreated()` to build the database on the first run. This is acceptable for demos, but in production apps you should look at [migrations](xref:core/managing-schemas/migrations/index) to manage your schema. The code also executes synchronously because it uses a local SQLite database. For production scenarios that typically involve a remote server, consider using the asynchronous versions of the `Load` and `SaveChanges` methods.
147
147
148
148
## Test the WPF Application
149
149
@@ -153,18 +153,18 @@ Compile and run the application by pressing **F5** or choosing **Debug > Star
153
153
154
154
## Property Change Notification
155
155
156
-
This example relies on four steps to synchronize the entities with the UI.
156
+
This example relies on four steps to synchronize the entities with the UI.
157
157
158
158
1. The initial call `_context.Categories.Load()` loads the categories data.
159
159
1. The lazy-loading proxies load the dependent products data.
160
160
1. EF Core's built-in change tracking makes the necessary modifications to entities, including insertions and deletions, when `_context.SaveChanges()` is called.
161
161
1. The calls to `DataGridView.Items.Refresh()` force a reload with the newly generated ids.
162
162
163
-
This works for our getting started sample, but you may require additional code for other scenarios. WPF controls render the UI by reading the fields and properties on your entities. When you edit a value in the user interface (UI), that value is passed to your entity. When you change the value of a property directly on your entity, such as loading it from the database, WPF will not immediately reflect the changes in the UI. The rendering engine must be notified of the changes. The project did this by manually calling `Refresh()`. An easy way to automate this notification is by implementing the [INotifyPropertyChanged](/dotnet/api/system.componentmodel.inotifypropertychanged) interface. WPF components will automatically detect the interface and register for change events. The entity is responsible for raising these events.
163
+
This works for our getting started sample, but you may require additional code for other scenarios. WPF controls render the UI by reading the fields and properties on your entities. When you edit a value in the user interface (UI), that value is passed to your entity. When you change the value of a property directly on your entity, such as loading it from the database, WPF will not immediately reflect the changes in the UI. The rendering engine must be notified of the changes. The project did this by manually calling `Refresh()`. An easy way to automate this notification is by implementing the [INotifyPropertyChanged](/dotnet/api/system.componentmodel.inotifypropertychanged) interface. WPF components will automatically detect the interface and register for change events. The entity is responsible for raising these events.
164
164
165
165
> [!TIP]
166
166
> To learn more about how to handle changes, read: [How to implement property change notification](/dotnet/framework/wpf/data/how-to-implement-property-change-notification).
167
167
168
168
## Next Steps
169
169
170
-
Learn more about [Configuring a DbContext](/ef/core/miscellaneous/configuring-dbcontext).
170
+
Learn more about [Configuring a DbContext](xref:core/miscellaneous/configuring-dbcontext).
Copy file name to clipboardExpand all lines: entity-framework/core/what-is-new/ef-core-5.0/whatsnew.md
+6-4
Original file line number
Diff line number
Diff line change
@@ -967,7 +967,7 @@ See the [Configuring Navigation Properties documentation](xref:core/modeling/rel
967
967
968
968
Migrations and scaffolding now allow namespaces to be specified on the command line. For example, to reverse engineer a database putting the context and model classes in different namespaces:
@@ -976,7 +976,7 @@ See the [Migrations](xref:core/managing-schemas/migrations/index#namespaces) and
976
976
---
977
977
Also, a connection string can now be passed to the `database-update` command:
978
978
979
-
```
979
+
```dotnetcli
980
980
dotnet ef database update --connection "connection string"
981
981
```
982
982
@@ -991,6 +991,7 @@ For performance reasons, EF doesn't do additional null-checks when reading value
991
991
Using `EnableDetailedErrors` will add extra null checking to queries such that, for a small performance overhead, these errors are easier to trace back to a root cause.
@@ -1046,7 +1048,7 @@ Documentation is tracked by issue [#2230](https://github.com/dotnet/EntityFramew
1046
1048
1047
1049
### Complete discriminator mapping
1048
1050
1049
-
EF Core uses a discriminator column for [TPH mapping of an inheritance hierarchy](/ef/core/modeling/inheritance). Some performance enhancements are possible so long as EF Core knows all possible values for the discriminator. EF Core 5.0 now implements these enhancements.
1051
+
EF Core uses a discriminator column for [TPH mapping of an inheritance hierarchy](xref:core/modeling/inheritance). Some performance enhancements are possible so long as EF Core knows all possible values for the discriminator. EF Core 5.0 now implements these enhancements.
1050
1052
1051
1053
For example, previous versions of EF Core would always generate this SQL for a query returning all types in a hierarchy:
1052
1054
@@ -1174,7 +1176,7 @@ The Azure Cosmos DB database provider now supports optimistic concurrency using
SaveChanges will then throw an `DbUpdateConcurrencyException` on a concurrency conflict, which [can be handled](/ef/core/saving/concurrency) to implement retries, etc.
1179
+
SaveChanges will then throw an `DbUpdateConcurrencyException` on a concurrency conflict, which [can be handled](xref:core/saving/concurrency) to implement retries, etc.
1178
1180
1179
1181
Documentation is tracked by issue [#2099](https://github.com/dotnet/EntityFramework.Docs/issues/2099).
Copy file name to clipboardExpand all lines: entity-framework/ef6/fundamentals/connection-resiliency/commit-failures.md
+5-4
Original file line number
Diff line number
Diff line change
@@ -5,10 +5,11 @@ ms.date: "10/23/2016"
5
5
ms.assetid: 5b1f7a7d-1b24-4645-95ec-5608a31ef577
6
6
---
7
7
# Handling transaction commit failures
8
+
8
9
> [!NOTE]
9
10
> **EF6.1 Onwards Only** - The features, APIs, etc. discussed in this page were introduced in Entity Framework 6.1. If you are using an earlier version, some or all of the information does not apply.
10
11
11
-
As part of 6.1 we are introducing a new connection resiliency feature for EF: the ability to detect and recover automatically when transient connection failures affect the acknowledgement of transaction commits. The full details of the scenario are best described in the blog post [SQL Database Connectivity and the Idempotency Issue](https://docs.microsoft.com/archive/blogs/adonet/sql-database-connectivity-and-the-idempotency-issue). In summary, the scenario is that when an exception is raised during a transaction commit there are two possible causes:
12
+
As part of 6.1 we are introducing a new connection resiliency feature for EF: the ability to detect and recover automatically when transient connection failures affect the acknowledgement of transaction commits. The full details of the scenario are best described in the blog post [SQL Database Connectivity and the Idempotency Issue](/archive/blogs/adonet/sql-database-connectivity-and-the-idempotency-issue). In summary, the scenario is that when an exception is raised during a transaction commit there are two possible causes:
12
13
13
14
1. The transaction commit failed on the server
14
15
2. The transaction commit succeeded on the server but a connectivity issue prevented the success notification from reaching the client
@@ -59,8 +60,8 @@ Before EF 6.1 there was not mechanism to handle commit failures in the EF produc
59
60
1. Add a non-tracked table to the database used to track the status of the transactions.
60
61
2. Insert a row into the table at the beginning of each transaction.
61
62
3. If the connection fails during the commit, check for the presence of the corresponding row in the database.
62
-
- If the row is present, continue normally, as the transaction was committed successfully
63
-
- If the row is absent, use an execution strategy to retry the current operation.
63
+
* If the row is present, continue normally, as the transaction was committed successfully
64
+
* If the row is absent, use an execution strategy to retry the current operation.
64
65
4. If the commit is successful, delete the corresponding row to avoid the growth of the table.
65
66
66
-
[This blog post](https://docs.microsoft.com/archive/blogs/adonet/sql-database-connectivity-and-the-idempotency-issue) contains sample code for accomplishing this on SQL Azure.
67
+
[This blog post](/archive/blogs/adonet/sql-database-connectivity-and-the-idempotency-issue) contains sample code for accomplishing this on SQL Azure.
Copy file name to clipboardExpand all lines: entity-framework/ef6/fundamentals/databinding/winforms.md
+1
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@ title: "Databinding with WinForms - EF6"
3
3
author: divega
4
4
ms.date: "10/23/2016"
5
5
ms.assetid: 80fc5062-2f1c-4dbd-ab6e-b99496784b36
6
+
uid: ef6/fundamentals/databinding/winforms
6
7
---
7
8
# Databinding with WinForms
8
9
This step-by-step walkthrough shows how to bind POCO types to Window Forms (WinForms) controls in a “master-detail" form. The application uses Entity Framework to populate objects with data from the database, track changes, and persist data to the database.
0 commit comments