diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index e138ec5d6a..0000000000 --- a/SECURITY.md +++ /dev/null @@ -1,41 +0,0 @@ - - -## Security - -Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). - -If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below. - -## Reporting Security Issues - -**Please do not report security vulnerabilities through public GitHub issues.** - -Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report). - -If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey). - -You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc). - -Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: - - * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) - * Full paths of source file(s) related to the manifestation of the issue - * The location of the affected source code (tag/branch/commit or direct URL) - * Any special configuration required to reproduce the issue - * Step-by-step instructions to reproduce the issue - * Proof-of-concept or exploit code (if possible) - * Impact of the issue, including how an attacker might exploit the issue - -This information will help us triage your report more quickly. - -If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs. - -## Preferred Languages - -We prefer all communications to be in English. - -## Policy - -Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd). - - diff --git a/entity-framework/core/change-tracking/change-detection.md b/entity-framework/core/change-tracking/change-detection.md index b61b76cf90..53fc30ddfe 100644 --- a/entity-framework/core/change-tracking/change-detection.md +++ b/entity-framework/core/change-tracking/change-detection.md @@ -13,7 +13,7 @@ Each instance tracks changes made Tracking property and relationship changes requires that the DbContext is able to detect these changes. This document covers how this detection happens, as well as how to use property notifications or change-tracking proxies to force immediate detection of changes. > [!TIP] -> You can run and debug into all the code in this document by [downloading the sample code from GitHub](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/ChangeTracking/ChangeDetectionAndNotifications). +> You can run and debug into all the code in this document by [downloading the sample code from GitHub](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/ChangeTracking/ChangeDetectionAndNotifications). ## Snapshot change tracking diff --git a/entity-framework/core/change-tracking/debug-views.md b/entity-framework/core/change-tracking/debug-views.md index 78f9fdcaa9..d73ccceefc 100644 --- a/entity-framework/core/change-tracking/debug-views.md +++ b/entity-framework/core/change-tracking/debug-views.md @@ -17,7 +17,7 @@ The Entity Framework Core (EF Core) change tracker generates two kinds of output > This document assumes that entity states and the basics of EF Core change tracking are understood. See [Change Tracking in EF Core](xref:core/change-tracking/index) for more information on these topics. > [!TIP] -> You can run and debug into all the code in this document by [downloading the sample code from GitHub](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/ChangeTracking/ChangeTrackerDebugging). +> You can run and debug into all the code in this document by [downloading the sample code from GitHub](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/ChangeTracking/ChangeTrackerDebugging). ## Change tracker debug view diff --git a/entity-framework/core/change-tracking/entity-entries.md b/entity-framework/core/change-tracking/entity-entries.md index 8548e9184f..8dd8c89e25 100644 --- a/entity-framework/core/change-tracking/entity-entries.md +++ b/entity-framework/core/change-tracking/entity-entries.md @@ -21,7 +21,7 @@ Each of these is described in more detail in the sections below. > This document assumes that entity states and the basics of EF Core change tracking are understood. See [Change Tracking in EF Core](xref:core/change-tracking/index) for more information on these topics. > [!TIP] -> You can run and debug into all the code in this document by [downloading the sample code from GitHub](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/ChangeTracking/AccessingTrackedEntities). +> You can run and debug into all the code in this document by [downloading the sample code from GitHub](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/ChangeTracking/AccessingTrackedEntities). ## Using DbContext.Entry and EntityEntry instances diff --git a/entity-framework/core/change-tracking/explicit-tracking.md b/entity-framework/core/change-tracking/explicit-tracking.md index 372b3be840..4fb359d737 100644 --- a/entity-framework/core/change-tracking/explicit-tracking.md +++ b/entity-framework/core/change-tracking/explicit-tracking.md @@ -16,7 +16,7 @@ Entity Framework Core (EF Core) change tracking works best when the same This document assumes that entity states and the basics of EF Core change tracking are understood. See [Change Tracking in EF Core](xref:core/change-tracking/index) for more information on these topics. > [!TIP] -> You can run and debug into all the code in this document by [downloading the sample code from GitHub](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/ChangeTracking/ChangeTrackingInEFCore). +> You can run and debug into all the code in this document by [downloading the sample code from GitHub](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/ChangeTracking/ChangeTrackingInEFCore). ## Introduction diff --git a/entity-framework/core/change-tracking/identity-resolution.md b/entity-framework/core/change-tracking/identity-resolution.md index 48a53e1c5e..c13c304174 100644 --- a/entity-framework/core/change-tracking/identity-resolution.md +++ b/entity-framework/core/change-tracking/identity-resolution.md @@ -14,7 +14,7 @@ A can only track one entity insta > This document assumes that entity states and the basics of EF Core change tracking are understood. See [Change Tracking in EF Core](xref:core/change-tracking/index) for more information on these topics. > [!TIP] -> You can run and debug into all the code in this document by [downloading the sample code from GitHub](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/ChangeTracking/IdentityResolutionInEFCore). +> You can run and debug into all the code in this document by [downloading the sample code from GitHub](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/ChangeTracking/IdentityResolutionInEFCore). ## Introduction diff --git a/entity-framework/core/change-tracking/index.md b/entity-framework/core/change-tracking/index.md index 8393957ca8..b83a717308 100644 --- a/entity-framework/core/change-tracking/index.md +++ b/entity-framework/core/change-tracking/index.md @@ -13,7 +13,7 @@ Each instance tracks changes made This document presents an overview of Entity Framework Core (EF Core) change tracking and how it relates to queries and updates. > [!TIP] -> You can run and debug into all the code in this document by [downloading the sample code from GitHub](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/ChangeTracking/ChangeTrackingInEFCore). +> You can run and debug into all the code in this document by [downloading the sample code from GitHub](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/ChangeTracking/ChangeTrackingInEFCore). ## How to track entities diff --git a/entity-framework/core/change-tracking/miscellaneous.md b/entity-framework/core/change-tracking/miscellaneous.md index 5a1aa8e6c5..25289c34f7 100644 --- a/entity-framework/core/change-tracking/miscellaneous.md +++ b/entity-framework/core/change-tracking/miscellaneous.md @@ -14,7 +14,7 @@ This document covers miscellaneous features and scenarios involving change track > This document assumes that entity states and the basics of EF Core change tracking are understood. See [Change Tracking in EF Core](xref:core/change-tracking/index) for more information on these topics. > [!TIP] -> You can run and debug into all the code in this document by [downloading the sample code from GitHub](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/ChangeTracking/AdditionalChangeTrackingFeatures). +> You can run and debug into all the code in this document by [downloading the sample code from GitHub](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/ChangeTracking/AdditionalChangeTrackingFeatures). ## `Add` versus `AddAsync` diff --git a/entity-framework/core/change-tracking/relationship-changes.md b/entity-framework/core/change-tracking/relationship-changes.md index 79ec272452..01ab9ad361 100644 --- a/entity-framework/core/change-tracking/relationship-changes.md +++ b/entity-framework/core/change-tracking/relationship-changes.md @@ -20,7 +20,7 @@ Navigations can be used on both sides of the relationship, on one side only, or > This document assumes that entity states and the basics of EF Core change tracking are understood. See [Change Tracking in EF Core](xref:core/change-tracking/index) for more information on these topics. > [!TIP] -> You can run and debug into all the code in this document by [downloading the sample code from GitHub](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/ChangeTracking/ChangingFKsAndNavigations). +> You can run and debug into all the code in this document by [downloading the sample code from GitHub](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/ChangeTracking/ChangingFKsAndNavigations). ### Example model diff --git a/entity-framework/core/get-started/overview/first-app.md b/entity-framework/core/get-started/overview/first-app.md index d3e47e7a07..e68a22c606 100644 --- a/entity-framework/core/get-started/overview/first-app.md +++ b/entity-framework/core/get-started/overview/first-app.md @@ -12,7 +12,7 @@ In this tutorial, you create a .NET console app that performs data access agains You can follow the tutorial by using Visual Studio on Windows, or by using the .NET CLI on Windows, macOS, or Linux. -[View this article's sample on GitHub](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/GetStarted). +[View this article's sample on GitHub](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/GetStarted). ## Prerequisites diff --git a/entity-framework/core/get-started/winforms.md b/entity-framework/core/get-started/winforms.md index 898ea90a2e..3e339dbada 100644 --- a/entity-framework/core/get-started/winforms.md +++ b/entity-framework/core/get-started/winforms.md @@ -13,7 +13,7 @@ This step-by-step walkthrough shows how to build a simple Windows Forms (WinForm The screen shots and code listings in this walkthrough are taken from Visual Studio 2022 17.3.0. > [!TIP] -> You can view this article's [sample on GitHub](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/WinForms). +> You can view this article's [sample on GitHub](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/WinForms). ## Prerequisites diff --git a/entity-framework/core/get-started/wpf.md b/entity-framework/core/get-started/wpf.md index 3d06ae909c..9b5c5ffa26 100644 --- a/entity-framework/core/get-started/wpf.md +++ b/entity-framework/core/get-started/wpf.md @@ -15,7 +15,7 @@ The model defines two types that participate in one-to-many relationship: **Cate The screen shots and code listings in this walkthrough are taken from Visual Studio 2019 16.6.5. > [!TIP] -> You can view this article's [sample on GitHub](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/WPF). +> You can view this article's [sample on GitHub](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/WPF). ## Pre-Requisites diff --git a/entity-framework/core/logging-events-diagnostics/diagnostic-listeners.md b/entity-framework/core/logging-events-diagnostics/diagnostic-listeners.md index da113f8006..147ecf38bd 100644 --- a/entity-framework/core/logging-events-diagnostics/diagnostic-listeners.md +++ b/entity-framework/core/logging-events-diagnostics/diagnostic-listeners.md @@ -9,7 +9,7 @@ uid: core/logging-events-diagnostics/diagnostic-listeners # Using Diagnostic Listeners in EF Core > [!TIP] -> You can [download this article's sample](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/DiagnosticListeners) from GitHub. +> You can [download this article's sample](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/DiagnosticListeners) from GitHub. Diagnostic listeners allow listening for any EF Core event that occurs in the current .NET process. The class is a part of a [common mechanism across .NET](https://github.com/dotnet/runtime/blob/main/src/libraries/System.Diagnostics.DiagnosticSource/src/DiagnosticSourceUsersGuide.md) for obtaining diagnostic information from running applications. @@ -92,7 +92,7 @@ For example, the code above handles the [!TIP] > ToString is overridden in every EF Core event data class to generate the equivalent log message for the event. For example, calling `ContextInitializedEventData.ToString` generates "Entity Framework Core 5.0.0 initialized 'BlogsContext' using provider 'Microsoft.EntityFrameworkCore.Sqlite' with options: None". -The [sample](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/DiagnosticListeners) contains a simple console application that makes changes to the blogging database and prints out the diagnostic events encountered. +The [sample](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/DiagnosticListeners) contains a simple console application that makes changes to the blogging database and prints out the diagnostic events encountered. > [!TIP] -> You can view this article's [sample](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Saving/Disconnected/) on GitHub. +> You can view this article's [sample](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Saving/Disconnected/) on GitHub. > [!TIP] > EF Core can only track one instance of any entity with a given primary key value. The best way to avoid this being an issue is to use a short-lived context for each unit-of-work such that the context starts empty, has entities attached to it, saves those entities, and then the context is disposed and discarded. diff --git a/entity-framework/core/saving/related-data.md b/entity-framework/core/saving/related-data.md index 7964fd9006..5b5c3cfcee 100644 --- a/entity-framework/core/saving/related-data.md +++ b/entity-framework/core/saving/related-data.md @@ -10,7 +10,7 @@ uid: core/saving/related-data In addition to isolated entities, you can also make use of the relationships defined in your model. > [!TIP] -> You can view this article's [sample](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Saving/RelatedData/) on GitHub. +> You can view this article's [sample](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Saving/RelatedData/) on GitHub. ## Adding a graph of new entities diff --git a/entity-framework/core/saving/transactions.md b/entity-framework/core/saving/transactions.md index 6091da0723..6788e93d87 100644 --- a/entity-framework/core/saving/transactions.md +++ b/entity-framework/core/saving/transactions.md @@ -10,7 +10,7 @@ uid: core/saving/transactions Transactions allow several database operations to be processed in an atomic manner. If the transaction is committed, all of the operations are successfully applied to the database. If the transaction is rolled back, none of the operations are applied to the database. > [!TIP] -> You can view this article's [sample](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Saving/Transactions/) on GitHub. +> You can view this article's [sample](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Saving/Transactions/) on GitHub. ## Default transaction behavior diff --git a/entity-framework/core/testing/testing-with-the-database.md b/entity-framework/core/testing/testing-with-the-database.md index 26df736ec1..7903fece8a 100644 --- a/entity-framework/core/testing/testing-with-the-database.md +++ b/entity-framework/core/testing/testing-with-the-database.md @@ -9,7 +9,7 @@ uid: core/testing/testing-with-the-database In this page, we discuss techniques for writing automated tests which involve the database system against which the application runs in production. Alternate testing approaches exist, where the production database system is swapped out by test doubles; see the [testing overview page](xref:core/testing/index) for more information. Note that testing against a different database than what is used in production (e.g. Sqlite) is not covered here, since the different database is used as a test double; this approach is covered in [Testing without your production database system](xref:core/testing/testing-without-the-database). -The main hurdle with testing which involves a real database is to ensure proper test isolation, so that tests running in parallel (or even in serial) don't interfere with each other. The full sample code for the below can be viewed [here](https://github.com/dotnet/EntityFramework.Docs/blob/live/samples/core/Testing/TestingWithTheDatabase). +The main hurdle with testing which involves a real database is to ensure proper test isolation, so that tests running in parallel (or even in serial) don't interfere with each other. The full sample code for the below can be viewed [here](https://github.com/dotnet/EntityFramework.Docs/blob/main/samples/core/Testing/TestingWithTheDatabase). > [!TIP] > This page shows [xUnit](https://xunit.net/) techniques, but similar concepts exist in other testing frameworks, including [NUnit](https://nunit.org/). @@ -96,7 +96,7 @@ Finally, we make our test class disposable, arranging for the fixture's `Cleanup Note that since xUnit only ever instantiates the collection fixture once, there is no need for us to use locking around database creation and seeding as we did above. -The full sample code for the above can be viewed [here](https://github.com/dotnet/EntityFramework.Docs/blob/live/samples/core/Testing/TestingWithTheDatabase/TransactionalBloggingControllerTest.cs). +The full sample code for the above can be viewed [here](https://github.com/dotnet/EntityFramework.Docs/blob/main/samples/core/Testing/TestingWithTheDatabase/TransactionalBloggingControllerTest.cs). > [!TIP] > If you have multiple test classes with tests which modify the database, you can still run them in parallel by having different fixtures, each referencing its own database. Creating and using many test databases isn't problematic and should be done whenever it's helpful. diff --git a/entity-framework/core/testing/testing-without-the-database.md b/entity-framework/core/testing/testing-without-the-database.md index 55f19e3bea..311804028e 100644 --- a/entity-framework/core/testing/testing-without-the-database.md +++ b/entity-framework/core/testing/testing-without-the-database.md @@ -49,7 +49,7 @@ At this point, your application is architected according to the repository patte [!code-csharp[Main](../../../samples/core/Testing/TestingWithoutTheDatabase/RepositoryBloggingControllerTest.cs?name=GetBlog)] -The full sample code can be viewed [here](https://github.com/dotnet/EntityFramework.Docs/blob/live/samples/core/Testing/TestingWithoutTheDatabase/RepositoryBloggingControllerTest.cs). +The full sample code can be viewed [here](https://github.com/dotnet/EntityFramework.Docs/blob/main/samples/core/Testing/TestingWithoutTheDatabase/RepositoryBloggingControllerTest.cs). ## SQLite in-memory @@ -61,7 +61,7 @@ To use in-memory SQLite, it's important to understand that a **new database is c Tests can now call `CreateContext`, which returns a context using the connection we set up in the constructor, ensuring we have a clean database with the seeded data. -The full sample code for SQLite in-memory testing can be viewed [here](https://github.com/dotnet/EntityFramework.Docs/blob/live/samples/core/Testing/TestingWithoutTheDatabase/SqliteInMemoryBloggingControllerTest.cs). +The full sample code for SQLite in-memory testing can be viewed [here](https://github.com/dotnet/EntityFramework.Docs/blob/main/samples/core/Testing/TestingWithoutTheDatabase/SqliteInMemoryBloggingControllerTest.cs). ## In-memory provider @@ -69,7 +69,7 @@ As discussed in the [testing overview page](xref:core/testing/choosing-a-testing [!code-csharp[Main](../../../samples/core/Testing/TestingWithoutTheDatabase/InMemoryBloggingControllerTest.cs?name=Constructor)] -The full sample code for in-memory testing can be viewed [here](https://github.com/dotnet/EntityFramework.Docs/blob/live/samples/core/Testing/TestingWithoutTheDatabase/InMemoryBloggingControllerTest.cs). +The full sample code for in-memory testing can be viewed [here](https://github.com/dotnet/EntityFramework.Docs/blob/main/samples/core/Testing/TestingWithoutTheDatabase/InMemoryBloggingControllerTest.cs). ### In-memory database naming diff --git a/entity-framework/core/what-is-new/ef-core-6.0/whatsnew.md b/entity-framework/core/what-is-new/ef-core-6.0/whatsnew.md index 3ff9c8b6cd..c9b6574e1a 100644 --- a/entity-framework/core/what-is-new/ef-core-6.0/whatsnew.md +++ b/entity-framework/core/what-is-new/ef-core-6.0/whatsnew.md @@ -11,7 +11,7 @@ uid: core/what-is-new/ef-core-6.0/whatsnew EF Core 6.0 has [shipped to NuGet](https://www.nuget.org/packages/Microsoft.EntityFrameworkCore/). This page contains an overview of interesting changes introduced in this release. > [!TIP] -> You can run and debug into the samples shown below by [downloading the sample code from GitHub](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore6). +> You can run and debug into the samples shown below by [downloading the sample code from GitHub](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore6). ## SQL Server temporal tables @@ -682,7 +682,7 @@ If supporting any of these features is critical to your success, then please vot ### Benchmarks > [!TIP] -> You can try compiling a large model and running a benchmark on it by [downloading the sample code from GitHub](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/CompiledModels). +> You can try compiling a large model and running a benchmark on it by [downloading the sample code from GitHub](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/CompiledModels). The model in the GitHub repo referenced above contains 449 entity types, 6390 properties, and 720 relationships. This is a moderately large model. Using [BenchmarkDotNet](https://www.nuget.org/packages/BenchmarkDotNet) to measure, the average time to first query is 1.02 seconds on a reasonably powerful laptop. Using compiled models brings this down to 117 milliseconds on the same hardware. An 8x to 10x improvement like this stays relatively constant as the model size increases. @@ -712,7 +712,7 @@ After these improvements, the gap between the popular "micro-ORM" [Dapper](https EF Core 6.0 contains many improvements to the Azure Cosmos DB database provider. > [!TIP] -> You can run and debug into all the the Cosmos-specific samples by [downloading the sample code from GitHub](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore6.Cosmos). +> You can run and debug into all the the Cosmos-specific samples by [downloading the sample code from GitHub](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore6.Cosmos). ### Default to implicit ownership @@ -2622,7 +2622,7 @@ modelBuilder --> [!code-csharp[WithDifferentTable](../../../../samples/core/Miscellaneous/NewInEFCore6/OptionalDependentsSample.cs?name=WithDifferentTable)] -See the [OptionalDependentsSample](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore6) in GitHub for more examples of optional dependents, including cases with nested optional dependents. +See the [OptionalDependentsSample](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore6) in GitHub for more examples of optional dependents, including cases with nested optional dependents. ## New mapping attributes @@ -3568,7 +3568,7 @@ The EF Core codebase now uses [C# nullable reference types (NRTs)](/dotnet/cshar ## Microsoft.Data.Sqlite 6.0 > [!TIP] -> You can run and debug into all the samples shown below by [downloading the sample code from GitHub](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore6). +> You can run and debug into all the samples shown below by [downloading the sample code from GitHub](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore6). ### Connection Pooling diff --git a/entity-framework/core/what-is-new/ef-core-7.0/whatsnew.md b/entity-framework/core/what-is-new/ef-core-7.0/whatsnew.md index 99f6a091a7..1a8a775baf 100644 --- a/entity-framework/core/what-is-new/ef-core-7.0/whatsnew.md +++ b/entity-framework/core/what-is-new/ef-core-7.0/whatsnew.md @@ -30,7 +30,7 @@ And a second aggregate type for post metadata: [!code-csharp[PostMetadataAggregate](../../../../samples/core/Miscellaneous/NewInEFCore7/BlogsContext.cs?name=PostMetadataAggregate)] > [!TIP] -> The sample model can be found in [BlogsContext.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore7/BlogsContext.cs). +> The sample model can be found in [BlogsContext.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore7/BlogsContext.cs). ## JSON Columns @@ -96,7 +96,7 @@ The aggregate type is configured in `OnModelCreating` using `OwnsOne`: [!code-csharp[TableSharingAggregate](../../../../samples/core/Miscellaneous/NewInEFCore7/JsonColumnsSample.cs?name=TableSharingAggregate)] > [!TIP] -> The code shown here comes from [JsonColumnsSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore7/JsonColumnsSample.cs). +> The code shown here comes from [JsonColumnsSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore7/JsonColumnsSample.cs). By default, relational database providers map aggregate types like this to the same table as the owning entity type. That is, each property of the `ContactDetails` and `Address` classes is mapped to a column in the `Authors` table. @@ -549,7 +549,7 @@ All of this means that the `ExecuteUpdate` and `ExecuteDelete` methods complemen ### Basic `ExecuteDelete` examples > [!TIP] -> The code shown here comes from [ExecuteDeleteSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore7/ExecuteDeleteSample.cs). +> The code shown here comes from [ExecuteDeleteSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore7/ExecuteDeleteSample.cs). Calling `ExecuteDelete` or `ExecuteDeleteAsync` on a `DbSet` immediately deletes all entities of that `DbSet` from the database. For example, to delete all `Tag` entities: @@ -602,7 +602,7 @@ WHERE NOT EXISTS ( ### Basic `ExecuteUpdate` examples > [!TIP] -> The code shown here comes from [ExecuteUpdateSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore7/ExecuteUpdateSample.cs). +> The code shown here comes from [ExecuteUpdateSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore7/ExecuteUpdateSample.cs). `ExecuteUpdate` and `ExecuteUpdateAsync` behave in a very similar way to the `ExecuteDelete` methods. The main difference is that an update requires knowing _which_ properties to update, and _how_ to update them. This is achieved using one or more calls to `SetProperty`. For example, to update the `Name` of every blog: @@ -790,7 +790,7 @@ Some examples of these improvements are shown below. > See [Announcing Entity Framework Core 7 Preview 6: Performance Edition](https://devblogs.microsoft.com/dotnet/announcing-ef-core-7-preview6-performance-optimizations/) on the .NET Blog for an in-depth discussion of these changes. > [!TIP] -> The code shown here comes from [SaveChangesPerformanceSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore7/SaveChangesPerformanceSample.cs). +> The code shown here comes from [SaveChangesPerformanceSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore7/SaveChangesPerformanceSample.cs). ### Unneeded transactions are eliminated @@ -1020,7 +1020,7 @@ In addition, different database systems require different SQL for many of these By default, EF Core maps an inheritance hierarchy of .NET types to a single database table. This is known as the [table-per-hierarchy (TPH)](xref:core/modeling/inheritance#table-per-hierarchy-and-discriminator-configuration) mapping strategy. EF Core 5.0 introduced the [table-per-type (TPT)](xref:core/modeling/inheritance#table-per-type-configuration) strategy, which supports mapping each .NET type to a different database table. EF7 introduces the table-per-concrete-type (TPC) strategy. TPC also maps .NET types to different tables, but in a way that addresses some common performance issues with the TPT strategy. > [!TIP] -> The code shown here comes from [TpcInheritanceSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore7/TpcInheritanceSample.cs). +> The code shown here comes from [TpcInheritanceSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore7/TpcInheritanceSample.cs). > [!TIP] > The EF Team demonstrated and talked in depth about TPC mapping in an episode of the .NET Data Community Standup. As with [all Community Standup episodes](https://aka.ms/efstandups), you can [watch the TPC episode now on YouTube](https://youtu.be/HaL6DKW1mrg). @@ -1486,7 +1486,7 @@ protected override void ConfigureConventions(ModelConfigurationBuilder configura > To find all built-in model building conventions, look for every class that implements the interface. > [!TIP] -> The code shown here comes from [ModelBuildingConventionsSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore7/ModelBuildingConventionsSample.cs). +> The code shown here comes from [ModelBuildingConventionsSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore7/ModelBuildingConventionsSample.cs). ### Removing an existing convention @@ -2324,7 +2324,7 @@ The following sections show some examples of using these new interception capabi ### Simple actions on entity creation > [!TIP] -> The code shown here comes from [SimpleMaterializationSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore7/SimpleMaterializationSample.cs). +> The code shown here comes from [SimpleMaterializationSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore7/SimpleMaterializationSample.cs). The new supports interception before and after an entity instance is created, and before and after properties of that instance are initialized. The interceptor can change or replace the entity instance at each point. This allows: @@ -2418,7 +2418,7 @@ Customer 'Alice' was retrieved at '9/22/2022 5:25:54 PM' ### Injecting services into entities > [!TIP] -> The code shown here comes from [InjectLoggerSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore7/InjectLoggerSample.cs). +> The code shown here comes from [InjectLoggerSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore7/InjectLoggerSample.cs). EF Core already has built-in support for injecting some special services into context instances; for example, see [Lazy loading without proxies](xref:core/querying/related-data/lazy#lazy-loading-without-proxies), which works by injecting the `ILazyLoader` service. @@ -2503,7 +2503,7 @@ info: CustomersLogger[1] ### LINQ expression tree interception > [!TIP] -> The code shown here comes from [QueryInterceptionSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore7/QueryInterceptionSample.cs). +> The code shown here comes from [QueryInterceptionSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore7/QueryInterceptionSample.cs). EF Core makes use of [.NET LINQ queries](xref:core/querying/how-query-works). This typically involves using the C#, VB, or F# compiler to build an expression tree which is then translated by EF Core into the appropriate SQL. For example, consider a method that returns a page of customers: @@ -2649,7 +2649,7 @@ In this case the `ThenBy` is simply added to the query. Yes, it may need to be d ### Optimistic concurrency interception > [!TIP] -> The code shown here comes from [OptimisticConcurrencyInterceptionSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore7/OptimisticConcurrencyInterceptionSample.cs). +> The code shown here comes from [OptimisticConcurrencyInterceptionSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore7/OptimisticConcurrencyInterceptionSample.cs). EF Core supports the [optimistic concurrency pattern](xref:core/saving/concurrency) by checking that the number of rows actually affected by an update or delete is the same as the number of rows expected to be affected. This is often coupled with a concurrency token; that is, a column value that will only match its expected value if the row has not been updated since the expected value was read. @@ -2694,7 +2694,7 @@ There are several things worth noting about this interceptor: ### Lazy initialization of a connection string > [!TIP] -> The code shown here comes from [LazyConnectionStringSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore7/LazyConnectionStringSample.cs). +> The code shown here comes from [LazyConnectionStringSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore7/LazyConnectionStringSample.cs). Connection strings are often static assets read from a configuration file. These can easily be passed to `UseSqlServer` or similar when configuring a `DbContext`. However, sometimes the connection string can change for each context instance. For example, each tenant in a multi-tenant system may have a different connection string. @@ -2783,7 +2783,7 @@ Finally, the interceptor uses this service to obtain the connection string async ### Logging SQL Server query statistics > [!TIP] -> The code shown here comes from [QueryStatisticsLoggerSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore7/QueryStatisticsLoggerSample.cs). +> The code shown here comes from [QueryStatisticsLoggerSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore7/QueryStatisticsLoggerSample.cs). Finally, let's create two interceptors that work together to send SQL Server query statistics to the application log. To generate the statistics, we need an to do two things. @@ -2870,7 +2870,7 @@ EF7 contains many improvements in the translation of LINQ queries. ### GroupBy as final operator > [!TIP] -> The code shown here comes from [GroupByFinalOperatorSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore7/GroupByFinalOperatorSample.cs). +> The code shown here comes from [GroupByFinalOperatorSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore7/GroupByFinalOperatorSample.cs). EF7 supports using `GroupBy` as the final operator in a query. For example, this LINQ query: @@ -2893,7 +2893,7 @@ ORDER BY [b].[Price] ### GroupJoin as final operator > [!TIP] -> The code shown here comes from [GroupJoinFinalOperatorSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore7/GroupByFinalOperatorSample.cs). +> The code shown here comes from [GroupJoinFinalOperatorSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore7/GroupByFinalOperatorSample.cs). EF7 supports using `GroupJoin` as the final operator in a query. For example, this LINQ query: @@ -2919,7 +2919,7 @@ ORDER BY [c].[Id] ### GroupBy entity type > [!TIP] -> The code shown here comes from [GroupByEntityTypeSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore7/GroupByEntityTypeSample.cs). +> The code shown here comes from [GroupByEntityTypeSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore7/GroupByEntityTypeSample.cs). EF7 supports grouping by an entity type. For example, this LINQ query: @@ -2961,7 +2961,7 @@ FROM [Authors] AS [a] ### Subqueries don't reference ungrouped columns from outer query > [!TIP] -> The code shown here comes from [UngroupedColumnsQuerySample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore7/UngroupedColumnsQuerySample.cs). +> The code shown here comes from [UngroupedColumnsQuerySample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore7/UngroupedColumnsQuerySample.cs). In EF Core 6.0, a `GROUP BY` clause would reference columns in the outer query, which fails with some databases and is inefficient in others. For example, consider the following query: @@ -3005,7 +3005,7 @@ GROUP BY [t].[Key] ### Read-only collections can be used for `Contains` > [!TIP] -> The code shown here comes from [ReadOnlySetQuerySample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore7/ReadOnlySetQuerySample.cs). +> The code shown here comes from [ReadOnlySetQuerySample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore7/ReadOnlySetQuerySample.cs). EF7 supports using `Contains` when the items to search for are contained in an `IReadOnlySet` or `IReadOnlyCollection`, or `IReadOnlyList`. For example, this LINQ query: @@ -3040,7 +3040,7 @@ EF7 introduces better extensibility for providers to translate aggregate functio #### String aggregate functions > [!TIP] -> The code shown here comes from [StringAggregateFunctionsSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore7/StringAggregateFunctionsSample.cs). +> The code shown here comes from [StringAggregateFunctionsSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore7/StringAggregateFunctionsSample.cs). Queries using and are now translated when appropriate. For example: @@ -3109,7 +3109,7 @@ ORDER BY [t].[Name] #### Spatial aggregate functions > [!TIP] -> The code shown here comes from [SpatialAggregateFunctionsSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore7/SpatialAggregateFunctionsSample.cs). +> The code shown here comes from [SpatialAggregateFunctionsSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore7/SpatialAggregateFunctionsSample.cs). It is now possible for [database providers that support for NetTopologySuite](xref:core/modeling/spatial) to translate the following spatial aggregate functions: @@ -3147,7 +3147,7 @@ GROUP BY [c].[Owner] #### Statistical aggregate functions > [!TIP] -> The code shown here comes from [StatisticalAggregateFunctionsSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore7/StatisticalAggregateFunctionsSample.cs). +> The code shown here comes from [StatisticalAggregateFunctionsSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore7/StatisticalAggregateFunctionsSample.cs). SQL Server translations have been implemented for the following statistical functions: @@ -3190,7 +3190,7 @@ GROUP BY [u].[Id] ### Translation of `string.IndexOf` > [!TIP] -> The code shown here comes from [MiscellaneousTranslationsSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore7/MiscellaneousTranslationsSample.cs). +> The code shown here comes from [MiscellaneousTranslationsSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore7/MiscellaneousTranslationsSample.cs). EF7 now translates in LINQ queries. For example: @@ -3212,7 +3212,7 @@ WHERE (CAST(CHARINDEX(N'Entity', [p].[Content]) AS int) - 1) > 0 ### Translation of `GetType` for entity types > [!TIP] -> The code shown here comes from [MiscellaneousTranslationsSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore7/MiscellaneousTranslationsSample.cs). +> The code shown here comes from [MiscellaneousTranslationsSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore7/MiscellaneousTranslationsSample.cs). EF7 now translates in LINQ queries. For example: @@ -3248,7 +3248,7 @@ And will return both `Post` and `FeaturedPost` entities. ### Support for `AT TIME ZONE` > [!TIP] -> The code shown here comes from [MiscellaneousTranslationsSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore7/MiscellaneousTranslationsSample.cs). +> The code shown here comes from [MiscellaneousTranslationsSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore7/MiscellaneousTranslationsSample.cs). EF7 introduces new functions for and . These functions translate to `AT TIME ZONE` clauses in the generated SQL. For example: @@ -3276,7 +3276,7 @@ FROM [Posts] AS [p] ### Filtered Include on hidden navigations > [!TIP] -> The code shown here comes from [MiscellaneousTranslationsSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore7/MiscellaneousTranslationsSample.cs). +> The code shown here comes from [MiscellaneousTranslationsSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore7/MiscellaneousTranslationsSample.cs). The [Include methods](xref:core/querying/related-data/eager) can now be used with . This allows [filtering and ordering](xref:core/querying/related-data/eager#filtered-include) even for private navigation properties, or private navigations represented by fields. For example: @@ -3315,7 +3315,7 @@ ORDER BY [b].[Id], [t].[Title] ### Cosmos translation for `Regex.IsMatch` > [!TIP] -> The code shown here comes from [CosmosQueriesSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore7/CosmosQueriesSample.cs). +> The code shown here comes from [CosmosQueriesSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore7/CosmosQueriesSample.cs). EF7 supports using in LINQ queries against Azure Cosmos DB. For example: @@ -3339,7 +3339,7 @@ WHERE ((c["Discriminator"] = "Triangle") AND RegexMatch(c["Name"], "[a-z]t[a-z]" EF7 contains a variety of small improvements to and related classes. > [!TIP] -> The code for samples in this section comes from [DbContextApiSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore7/DbContextApiSample.cs). +> The code for samples in this section comes from [DbContextApiSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore7/DbContextApiSample.cs). ### Suppressor for uninitialized DbSet properties @@ -3553,7 +3553,7 @@ Notice: EF7 contains a variety of small improvements in model building. > [!TIP] -> The code for samples in this section comes from [ModelBuildingSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore7/ModelBuildingSample.cs). +> The code for samples in this section comes from [ModelBuildingSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore7/ModelBuildingSample.cs). ### Indexes can be ascending or descending @@ -4067,7 +4067,7 @@ If these types are mapped to the same table, then in EF7 that table can be made EF7 includes two significant improvements to the automatic generation of values for key properties. > [!TIP] -> The code for samples in this section comes from [ValueGenerationSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore7/ValueGenerationSample.cs). +> The code for samples in this section comes from [ValueGenerationSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore7/ValueGenerationSample.cs). ### Value generation for DDD guarded types @@ -4331,4 +4331,4 @@ public partial class MainForm : Form } ``` -See [Getting Started with Windows Forms](xref:core/get-started/winforms) for a complete walkthrough and [downloadable WinForms sample application](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/WinForms). +See [Getting Started with Windows Forms](xref:core/get-started/winforms) for a complete walkthrough and [downloadable WinForms sample application](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/WinForms). diff --git a/entity-framework/core/what-is-new/ef-core-8.0/whatsnew.md b/entity-framework/core/what-is-new/ef-core-8.0/whatsnew.md index e4163bf8da..00dd937cac 100644 --- a/entity-framework/core/what-is-new/ef-core-8.0/whatsnew.md +++ b/entity-framework/core/what-is-new/ef-core-8.0/whatsnew.md @@ -665,7 +665,7 @@ The first option has advantages in many situations--we'll take a quick look at i Starting with Preview 4, EF8 now includes built-in support for the second option, using JSON as the serialization format. JSON works well for this since modern relational databases include built-in mechanisms for querying and manipulating JSON, such that the JSON column can, effectively, be treated as a table when needed, without the overhead of actually creating that table. These same mechanisms allow JSON to be passed in parameters and then used in similar way to table-valued parameters in queries--more about this later. > [!TIP] -> The code shown here comes from [PrimitiveCollectionsSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore8/PrimitiveCollectionsSample.cs). +> The code shown here comes from [PrimitiveCollectionsSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore8/PrimitiveCollectionsSample.cs). ### Primitive collection properties @@ -1017,7 +1017,7 @@ In all the examples above, column for primitive collection contains JSON. Howeve [!code-csharp[Pub](../../../../samples/core/Miscellaneous/NewInEFCore8/PrimitiveCollectionsInJsonSample.cs?name=Pub)] > [!TIP] -> The code shown here comes from [PrimitiveCollectionsInJsonSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore8/PrimitiveCollectionsInJsonSample.cs). +> The code shown here comes from [PrimitiveCollectionsInJsonSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore8/PrimitiveCollectionsInJsonSample.cs). We can now run a variation of our final query that, this time, extracts data from the JSON document, including queries into the primitive collections contained in the document: @@ -1120,7 +1120,7 @@ CREATE TABLE [Beer] ( EF8 includes improvements to the [JSON column mapping support introduced in EF7](xref:core/what-is-new/ef-core-7.0/whatsnew#json-columns). > [!TIP] -> The code shown here comes from [JsonColumnsSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore8/JsonColumnsSample.cs). +> The code shown here comes from [JsonColumnsSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore8/JsonColumnsSample.cs). ### Translate element access into JSON arrays @@ -1241,7 +1241,7 @@ EF7 introduced support for mapping to JSON columns when using Azure SQL/SQL Serv The existing [documentation from What's New in EF7](xref:core/what-is-new/ef-core-7.0/whatsnew#json-columns) provides detailed information on JSON mapping, queries, and updates. This documentation now also applies to SQLite. > [!TIP] -> The code shown in the EF7 documentation has been updated to also run on SQLite can can be found in [JsonColumnsSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore8/JsonColumnsSample.cs). +> The code shown in the EF7 documentation has been updated to also run on SQLite can can be found in [JsonColumnsSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore8/JsonColumnsSample.cs). #### Queries into JSON columns @@ -1347,7 +1347,7 @@ The `HierarchyId` type can be used for properties of an entity type. For example [!code-csharp[Halfling](../../../../samples/core/Miscellaneous/NewInEFCore8/HierarchyIdSample.cs?name=Halfling)] > [!TIP] -> The code shown here and in the examples below comes from [HierarchyIdSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore8/HierarchyIdSample.cs). +> The code shown here and in the examples below comes from [HierarchyIdSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore8/HierarchyIdSample.cs). > [!TIP] > If desired, `HierarchyId` is suitable for use as a key property type. @@ -1661,7 +1661,7 @@ Following the update, querying for the descendents of "Mungo" returns "Bungo", " EF7 introduced [raw SQL queries returning scalar types](xref:core/querying/sql-queries#querying-scalar-(non-entity)-types). This is enhanced in EF8 to include raw SQL queries returning any mappable CLR type, without including that type in the EF model. > [!TIP] -> The code shown here comes from [RawSqlSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore8/RawSqlSample.cs). +> The code shown here comes from [RawSqlSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore8/RawSqlSample.cs). Queries using unmapped types are executed using or . The former uses string interpolation to parameterize the query, which helps ensure that all non-constant values are parameterized. For example, consider the following database table: @@ -1850,7 +1850,7 @@ The returned `IQueryable` can be composed upon when it is the result of a view o EF8 adds support for [lazy-loading of navigations](xref:core/querying/related-data/lazy) on entities that are not being tracked by the `DbContext`. This means a no-tracking query can be followed by lazy-loading of navigations on the entities returned by the no-tracking query. > [!TIP] -> The code for the lazy-loading examples shown below comes from [LazyLoadingSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore8/LazyLoadingSample.cs). +> The code for the lazy-loading examples shown below comes from [LazyLoadingSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore8/LazyLoadingSample.cs). For example, consider a no-tracking query for blogs: @@ -1943,7 +1943,7 @@ EF8 contains new public APIs so that applications can now use these data structu [!code-csharp[LookupByPrimaryKey](../../../../samples/core/Miscellaneous/NewInEFCore8/LookupByKeySample.cs?name=LookupByPrimaryKey)] > [!TIP] -> The code shown here comes from [LookupByKeySample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore8/LookupByKeySample.cs). +> The code shown here comes from [LookupByKeySample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore8/LookupByKeySample.cs). The [`FindEntry`](https://github.com/dotnet/efcore/blob/81886272a761df8fafe4970b895b1e1fe35effb8/src/EFCore/ChangeTracking/LocalView.cs#L543) method returns either the for the tracked entity, or `null` if no entity with the given key is being tracked. Like all methods on `LocalView`, the database is never queried, even if the entity is not found. The returned entry contains the entity itself, as well as tracking information. For example: @@ -2082,7 +2082,7 @@ public class OpeningHours [!code-csharp[BritishSchools](../../../../samples/core/Miscellaneous/NewInEFCore8/DateOnlyTimeOnlySample.cs?name=BritishSchools)] > [!TIP] -> The code shown here comes from [DateOnlyTimeOnlySample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore8/DateOnlyTimeOnlySample.cs). +> The code shown here comes from [DateOnlyTimeOnlySample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore8/DateOnlyTimeOnlySample.cs). > [!NOTE] > This model represents only British schools and stores times as local (GMT) times. Handling different timezones would complicate this code significantly. Note that using `DateTimeOffset` would not help here, since opening and closing times have different offsets depending whether daylight saving time is active or not. @@ -2283,7 +2283,7 @@ b.Property(e => e.LeaseDate).HasDefaultValueSql("getutcdate()"); ``` > [!TIP] -> The code shown below comes from [DefaultConstraintSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore8/DefaultConstraintSample.cs). +> The code shown below comes from [DefaultConstraintSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore8/DefaultConstraintSample.cs). In order for EF to make use of this, it must determine when and when not to send a value for the column. By default, EF uses the CLR default as a sentinel for this. That is, when the value of `Status` or `LeaseDate` in the examples above are the CLR defaults for these types, then EF _interprets that to mean that the property has not been set_, and so does not send a value to the database. This works well for reference types--for example, if the `string` property `Status` is `null`, then EF doesn't send `null` to the database, but rather does not include any value so that the database default (`"Hidden"`) is used. Likewise, for the `DateTime` property `LeaseDate`, EF will not insert the CLR default value of `1/1/0001 12:00:00 AM`, but will instead omit this value so that database default is used. diff --git a/entity-framework/core/what-is-new/ef-core-9.0/whatsnew.md b/entity-framework/core/what-is-new/ef-core-9.0/whatsnew.md index 9607381168..dd6003db2b 100644 --- a/entity-framework/core/what-is-new/ef-core-9.0/whatsnew.md +++ b/entity-framework/core/what-is-new/ef-core-9.0/whatsnew.md @@ -75,7 +75,7 @@ To learn more about querying with partition keys and point reads, [see the query ### Hierarchical partition keys > [!TIP] -> The code shown here comes from [HierarchicalPartitionKeysSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore9.Cosmos/HierarchicalPartitionKeysSample.cs). +> The code shown here comes from [HierarchicalPartitionKeysSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore9.Cosmos/HierarchicalPartitionKeysSample.cs). Azure Cosmos DB originally supported a single partition key, but has since expanded partitioning capabilities to also support [subpartitioning through the specification of up to three levels of hierarchy in the partition key](/azure/cosmos-db/hierarchical-partition-keys). EF Core 9 brings full support for hierarchical partition keys, allowing you take advantage of the better performance and cost savings associated with this feature. @@ -342,7 +342,7 @@ We'd like to call out Andrea Canciani ([@ranma42](https://github.com/ranma42)) f #### GroupBy > [!TIP] -> The code shown here comes from [ComplexTypesSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore9/ComplexTypesSample.cs). +> The code shown here comes from [ComplexTypesSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore9/ComplexTypesSample.cs). EF9 supports grouping by a complex type instance. For example: @@ -365,7 +365,7 @@ GROUP BY [s].[StoreAddress_City], [s].[StoreAddress_Country], [s].[StoreAddress_ #### ExecuteUpdate > [!TIP] -> The code shown here comes from [ExecuteUpdateSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore9/ExecuteUpdateSample.cs). +> The code shown here comes from [ExecuteUpdateSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore9/ExecuteUpdateSample.cs). Similarly, in EF9 `ExecuteUpdate` has also been improved to accept complex type properties. However, each member of the complex type must be specified explicitly. For example: @@ -506,7 +506,7 @@ FROM ( ### Translations involving GREATEST/LEAST > [!TIP] -> The code shown here comes from [LeastGreatestSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore9/LeastGreatestSample.cs). +> The code shown here comes from [LeastGreatestSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore9/LeastGreatestSample.cs). Several new translations have been introduced that use the `GREATEST` and `LEAST` SQL functions. @@ -584,7 +584,7 @@ FROM [Pubs] AS [p] ### Force or prevent query parameterization > [!TIP] -> The code shown here comes from [QuerySample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore9/QuerySample.cs). +> The code shown here comes from [QuerySample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore9/QuerySample.cs). Except in some special cases, EF Core parameterizes variables used in a LINQ query, but includes constants in the generated SQL. For example, consider the following query method: @@ -710,7 +710,7 @@ Moreover, EF9 introduces `TranslateParameterizedCollectionsToConstants` [context ### Inlined uncorrelated subqueries > [!TIP] -> The code shown here comes from [QuerySample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore9/QuerySample.cs). +> The code shown here comes from [QuerySample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore9/QuerySample.cs). In EF8, an IQueryable referenced in another query may be executed as a separate database roundtrip. For example, consider the following LINQ query: @@ -824,7 +824,7 @@ var topRatedPostsAverageRatingByLanguage = await context.Blogs. ### Queries using Count != 0 are optimized > [!TIP] -> The code shown here comes from [QuerySample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore9/QuerySample.cs). +> The code shown here comes from [QuerySample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore9/QuerySample.cs). In EF8, the following LINQ query was translated to use the SQL `COUNT` function: @@ -1121,7 +1121,7 @@ More information can be found [here](/ef/core/modeling/data-seeding#use-seeding- ### Auto-compiled models > [!TIP] -> The code shown here comes from the [NewInEFCore9.CompiledModels](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore9.CompiledModels/) sample. +> The code shown here comes from the [NewInEFCore9.CompiledModels](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore9.CompiledModels/) sample. Compiled models can improve startup time for applications with large models--that is entity type counts in the 100s or 1000s. In previous versions of EF Core, a compiled model had to be generated manually, using the command line. For example: @@ -1221,7 +1221,7 @@ For more information see [MSBuild integration](xref:core/cli/msbuild). ### Read-only primitive collections > [!TIP] -> The code shown here comes from [PrimitiveCollectionsSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore9/PrimitiveCollectionsSample.cs). +> The code shown here comes from [PrimitiveCollectionsSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore9/PrimitiveCollectionsSample.cs). EF8 introduced support for [mapping arrays and mutable lists of primitive types](xref:core/what-is-new/ef-core-8.0/whatsnew#primitive-collections). This has been expanded in EF9 to include read-only collections/lists. Specifically, EF9 supports collections typed as `IReadOnlyList`, `IReadOnlyCollection`, or `ReadOnlyCollection`. For example, in the following code, `DaysVisited` will be mapped by convention as a primitive collection of dates: @@ -1281,7 +1281,7 @@ INNER JOIN "Pubs" AS "p" ON "w"."ClosestPubId" = "p"."Id" ### Specify fill-factor for keys and indexes > [!TIP] -> The code shown here comes from [ModelBuildingSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore9/ModelBuildingSample.cs). +> The code shown here comes from [ModelBuildingSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore9/ModelBuildingSample.cs). EF9 supports specification of the [SQL Server fill-factor](/sql/relational-databases/indexes/specify-fill-factor-for-an-index) when using EF Core Migrations to create keys and indexes. From the SQL Server docs, "When an index is created or rebuilt, the fill-factor value determines the percentage of space on each leaf-level page to be filled with data, reserving the remainder on each page as free space for future growth." @@ -1328,7 +1328,7 @@ This enhancement was contributed by [@deano-hunter](https://github.com/deano-hun ### Make existing model building conventions more extensible > [!TIP] -> The code shown here comes from [CustomConventionsSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore9/CustomConventionsSample.cs). +> The code shown here comes from [CustomConventionsSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore9/CustomConventionsSample.cs). Public model building conventions for applications were [introduced in EF7](xref:core/modeling/bulk-configuration#Conventions). In EF9, we have made it easier to extend some of the existing conventions. For example, [the code to map properties by attribute in EF7](xref:core/what-is-new/ef-core-7.0/whatsnew#model-building-conventions) is this: @@ -1451,7 +1451,7 @@ As an aside, some people think this pattern is an abomination because it couples ## SQL Server HierarchyId > [!TIP] -> The code shown here comes from [HierarchyIdSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/live/samples/core/Miscellaneous/NewInEFCore9/HierarchyIdSample.cs). +> The code shown here comes from [HierarchyIdSample.cs](https://github.com/dotnet/EntityFramework.Docs/tree/main/samples/core/Miscellaneous/NewInEFCore9/HierarchyIdSample.cs).