From 56f6971aef8c6bc30808ad39c3e2dc6c90e7ca09 Mon Sep 17 00:00:00 2001 From: James Montemagno Date: Wed, 2 Apr 2025 13:22:19 -0700 Subject: [PATCH 1/5] Add .NET 10 Preview 4 --- .../10.0/preview/preview4/10.0.0-preview.4.md | 6 +++ release-notes/10.0/preview/preview4/README.md | 40 +++++++++++++++++++ .../10.0/preview/preview4/aspnetcore.md | 15 +++++++ .../10.0/preview/preview4/containers.md | 9 +++++ release-notes/10.0/preview/preview4/csharp.md | 14 +++++++ .../10.0/preview/preview4/dotnetmaui.md | 24 +++++++++++ release-notes/10.0/preview/preview4/efcore.md | 30 ++++++++++++++ release-notes/10.0/preview/preview4/fsharp.md | 21 ++++++++++ .../10.0/preview/preview4/libraries.md | 13 ++++++ .../10.0/preview/preview4/runtime.md | 13 ++++++ release-notes/10.0/preview/preview4/sdk.md | 13 ++++++ .../10.0/preview/preview4/visualbasic.md | 6 +++ .../10.0/preview/preview4/winforms.md | 14 +++++++ release-notes/10.0/preview/preview4/wpf.md | 13 ++++++ 14 files changed, 231 insertions(+) create mode 100644 release-notes/10.0/preview/preview4/10.0.0-preview.4.md create mode 100644 release-notes/10.0/preview/preview4/README.md create mode 100644 release-notes/10.0/preview/preview4/aspnetcore.md create mode 100644 release-notes/10.0/preview/preview4/containers.md create mode 100644 release-notes/10.0/preview/preview4/csharp.md create mode 100644 release-notes/10.0/preview/preview4/dotnetmaui.md create mode 100644 release-notes/10.0/preview/preview4/efcore.md create mode 100644 release-notes/10.0/preview/preview4/fsharp.md create mode 100644 release-notes/10.0/preview/preview4/libraries.md create mode 100644 release-notes/10.0/preview/preview4/runtime.md create mode 100644 release-notes/10.0/preview/preview4/sdk.md create mode 100644 release-notes/10.0/preview/preview4/visualbasic.md create mode 100644 release-notes/10.0/preview/preview4/winforms.md create mode 100644 release-notes/10.0/preview/preview4/wpf.md diff --git a/release-notes/10.0/preview/preview4/10.0.0-preview.4.md b/release-notes/10.0/preview/preview4/10.0.0-preview.4.md new file mode 100644 index 0000000000..c8a322d5ad --- /dev/null +++ b/release-notes/10.0/preview/preview4/10.0.0-preview.4.md @@ -0,0 +1,6 @@ +# .NET 10 Preview 4 Binaries + +.NET 10 Preview 4 installers and binaries can be downloaded for the following product versions: + +- `.NET 10.0.0 Preview 4` +- `.NET SDK 10.0.100-preview.4.xxxx.xx` diff --git a/release-notes/10.0/preview/preview4/README.md b/release-notes/10.0/preview/preview4/README.md new file mode 100644 index 0000000000..4d6884c0f7 --- /dev/null +++ b/release-notes/10.0/preview/preview4/README.md @@ -0,0 +1,40 @@ +# .NET 10 Preview 4 - Release Notes + +.NET 10 Preview 4 released on April X, 2025. Find more information on new features released in .NET 10 Preview 4 by browsing through the release notes below: + +- [Libraries](./libraries.md) +- [Runtime](./runtime.md) +- [SDK](./sdk.md) + +## Languages + +- [C#](./csharp.md) +- [F#](./fsharp.md) +- [Visual Basic](./visualbasic.md) + +## Workloads, Libraries, & More + +- [.NET MAUI](./dotnetmaui.md) +- [ASP.NET Core](./aspnetcore.md) +- [Container images](./containers.md) +- [EF Core & Data](./efcore.md) +- [Windows Forms](./winforms.md) +- [WPF](./wpf.md) + +## Get Started + +Instructions on getting started with .NET 10 can be found in the [getting started guide](../../get-started.md). Installers and binaries for .NET 10 Preview 4 can be found [here on GitHub](./10.0.0-preview.3.md). + +## Stay up-to-date + +You can find a detailed overview of all new features in .NET 10: + +- [What's new in .NET 10](https://learn.microsoft.com/dotnet/core/whats-new/dotnet-10/overview) +- [What's new in C# 14](https://learn.microsoft.com/dotnet/csharp/whats-new/csharp-14) +- [What's new in .NET MAUI](https://learn.microsoft.com/dotnet/maui/whats-new/dotnet-10) +- [What's new in ASP.NET Core](https://learn.microsoft.com/aspnet/core/release-notes/aspnetcore-10.0) +- [What's new in Entity Framework Core](https://learn.microsoft.com/ef/core/what-is-new/ef-core-10.0/whatsnew) +- [What's new in Windows Forms](https://learn.microsoft.com/dotnet/desktop/winforms/whats-new/net100) +- [What's new in WPF](https://learn.microsoft.com/dotnet/desktop/wpf/whats-new/net100) + +The latest .NET 10 release is always available at [dotnet.microsoft.com](https://dotnet.microsoft.com/download/dotnet/10.0) and [.NET 10 Releases](../../README.md). diff --git a/release-notes/10.0/preview/preview4/aspnetcore.md b/release-notes/10.0/preview/preview4/aspnetcore.md new file mode 100644 index 0000000000..a73ffd4de8 --- /dev/null +++ b/release-notes/10.0/preview/preview4/aspnetcore.md @@ -0,0 +1,15 @@ +# ASP.NET Core in .NET 10 Preview 4 - Release Notes + +Here's a summary of what's new in ASP.NET Core in this preview release: + +- [Feature](#feature) + +ASP.NET Core updates in .NET 10: + +- [What's new in ASP.NET Core in .NET 10](https://learn.microsoft.com/aspnet/core/release-notes/aspnetcore-10.0) documentation. +- [Breaking changes](https://docs.microsoft.com/dotnet/core/compatibility/10.0#aspnet-core) +- [Roadmap](https://github.com/dotnet/aspnetcore/issues/59443) + +## Feature + +Something about the feature diff --git a/release-notes/10.0/preview/preview4/containers.md b/release-notes/10.0/preview/preview4/containers.md new file mode 100644 index 0000000000..96e348d719 --- /dev/null +++ b/release-notes/10.0/preview/preview4/containers.md @@ -0,0 +1,9 @@ +# Container image updates in .NET 10 Preview 4 - Release Notes + +Here's a summary of what's new in container images in this preview release: + +- [Feature](#feature) + +## Feature + +Something about the feature diff --git a/release-notes/10.0/preview/preview4/csharp.md b/release-notes/10.0/preview/preview4/csharp.md new file mode 100644 index 0000000000..35761b12b0 --- /dev/null +++ b/release-notes/10.0/preview/preview4/csharp.md @@ -0,0 +1,14 @@ +# C# 14 updates in .NET 10 Preview 43 - Release Notes + +Here's a summary of what's new in C# in this preview release: + +- [Feature](#feature) + +C# 14 updates: + +- [What's new in C# 14](https://learn.microsoft.com/dotnet/csharp/whats-new/csharp-14) documentation +- [Breaking changes in C# 14](https://learn.microsoft.com/dotnet/csharp/whats-new/breaking-changes/compiler%20breaking%20changes%20-%20dotnet%2010) + +## Feature + +Something about the feature diff --git a/release-notes/10.0/preview/preview4/dotnetmaui.md b/release-notes/10.0/preview/preview4/dotnetmaui.md new file mode 100644 index 0000000000..1841a0efa3 --- /dev/null +++ b/release-notes/10.0/preview/preview4/dotnetmaui.md @@ -0,0 +1,24 @@ +# .NET MAUI in .NET 10 Preview 4 - Release Notes + +Here's a summary of what's new in .NET MAUI, .NET for Android, and .NET for iOS, Mac Catalyst, macOS, and tvOS in this preview release: + +- .NET MAUI + - [Feature](#feature) +- [.NET for Android](#net-for-android) +- [.NET for iOS, Mac Catalyst, macOS, tvOS](#net-for-ios-mac-catalyst-macos-tvos) + +.NET MAUI updates in .NET 10: + +- [What's new in .NET MAUI in .NET 10](https://learn.microsoft.com/dotnet/maui/whats-new/dotnet-10) documentation. + +## Feature + +Something about the feature + +## .NET for Android + +This release was focused on quality improvements. A detailed list can be found on [dotnet/android GitHub releases](https://github.com/dotnet/android/releases/). + +## .NET for iOS, Mac Catalyst, macOS, tvOS + +This release was focused on quality improvements. A detailed list can be found on [dotnet/macios GitHub releases](https://github.com/dotnet/macios/releases/) including a list of [Known issues](https://github.com/dotnet/macios/wiki/Known-issues-in-.NET10). diff --git a/release-notes/10.0/preview/preview4/efcore.md b/release-notes/10.0/preview/preview4/efcore.md new file mode 100644 index 0000000000..8e6e616b50 --- /dev/null +++ b/release-notes/10.0/preview/preview4/efcore.md @@ -0,0 +1,30 @@ +# Entity Framework Core 10 Preview 4 - Release Notes + +Here's a summary of what's new in Entity Framework Core in this preview release: + +- [Improved experience when evolving the model on Azure Cosmos DB for NoSQL](#improved-experience-when-evolving-the-model-on-azure-cosmos-db-for-nosql) +- [Small improvements](#small-improvements) + +Entity Framework Core 10 updates: + +- [What's new in Entity Framework Core 10](https://learn.microsoft.com/ef/core/what-is-new/ef-core-10.0/whatsnew) documentation +- [Breaking change in Entity Framework Core 10](https://learn.microsoft.com/ef/core/what-is-new/ef-core-10.0/breaking-changes) + +## Improved experience when evolving the model on Azure Cosmos DB for NoSQL + +In previous versions of EF Core, evolving the model when using Azure Cosmos DB was quite painful. Specifically, when adding a new required property to the entity, EF would no longer be able to materialize that entity. The reason was that EF expected a value for the new property (since it was required), but the document created before the change didn't contain those values. The workaround was to mark the property as optional first, manually add default values for the property, and only then change it to required. + +In EF 10 Preview 4 we improved this experience - EF will now materialize a default value for a required property, if no data is present for it in the document, rather than throw. + +## Small improvements + +- Redact inlined constants from log when sensitive logging is off ([#35724](https://github.com/dotnet/efcore/pull/35724)). +- Improve LoadExtension to work correctly with dotnet run and lib* named libs ([#35617](https://github.com/dotnet/efcore/pull/35617), contributed by [@krwq](https://github.com/krwq)). + +## Everything else in Preview 4 + +Preview 4 contains: + +- [4 enhancements](https://github.com/dotnet/efcore/issues?q=is%3Aissue%20is%3Aclosed%20label%3Apreview-3%20(milestone%3A9.0.5%20OR%20milestone%3A10.0.0)%20label%3Atype-enhancement) +- [2 regression bug fixes](https://github.com/dotnet/efcore/issues?q=is%3Aissue%20is%3Aclosed%20label%3Apreview-3%20(milestone%3A9.0.5%20OR%20milestone%3A10.0.0)%20label%3Atype-bug%20label%3Aregression) +- [2 non-regression bug fixes](https://github.com/dotnet/efcore/issues?q=is%3Aissue%20is%3Aclosed%20label%3Apreview-3%20(milestone%3A10.0.0)%20label%3Atype-bug%20-label%3Aregression) diff --git a/release-notes/10.0/preview/preview4/fsharp.md b/release-notes/10.0/preview/preview4/fsharp.md new file mode 100644 index 0000000000..8d63b8d13a --- /dev/null +++ b/release-notes/10.0/preview/preview4/fsharp.md @@ -0,0 +1,21 @@ +# F# updates in .NET 10 Preview 4 - Release Notes + +Here's a summary of what's new in F# in this preview release: + +- [F# Language](#f-language) +- [FSharp.Core standard library](#fsharpcore-standard-library) +- [FSharp.Compiler.Service](#fsharpcompilerservice) + +> Note: Release notes for F# are generated for all contributions to the [dotnet/fsharp](https://github.com/dotnet/fsharp) repository and split across language, library and compiler changes. + +## F# Language + +[Release notes for new F# language features](https://fsharp.github.io/fsharp-compiler-docs/release-notes/Language.html) list language changes that have to be enabled by `preview` project property in `.fsproj` project file. They will become the default with .NET 10 release. + +## FSharp.Core Standard Library + +[Changes to the FSharp.Core standard library](https://fsharp.github.io/fsharp-compiler-docs/release-notes/FSharp.Core.html) are applied automatically to projects compiled with new SDK, unless they pin down a lower FSharp.Core version. + +## FSharp.Compiler.Service + +General improvements and bugfixes in the compiler implementation are at [Release notes for FSharp.Compiler.Service](https://fsharp.github.io/fsharp-compiler-docs/release-notes/FSharp.Compiler.Service.html). diff --git a/release-notes/10.0/preview/preview4/libraries.md b/release-notes/10.0/preview/preview4/libraries.md new file mode 100644 index 0000000000..3180c2b340 --- /dev/null +++ b/release-notes/10.0/preview/preview4/libraries.md @@ -0,0 +1,13 @@ +# .NET Libraries in .NET 10 Preview 4 - Release Notes + +Here's a summary of what's new in .NET Libraries in this preview release: + +- [Feature](#feature) + +.NET Libraries updates in .NET 10: + +- [What's new in .NET 10](https://learn.microsoft.com/dotnet/core/whats-new/dotnet-10/overview) documentation + +## Feature + +Something about the feature diff --git a/release-notes/10.0/preview/preview4/runtime.md b/release-notes/10.0/preview/preview4/runtime.md new file mode 100644 index 0000000000..dd565bbc30 --- /dev/null +++ b/release-notes/10.0/preview/preview4/runtime.md @@ -0,0 +1,13 @@ +# .NET Runtime in .NET 10 Preview 4 - Release Notes + +Here's a summary of what's new in the .NET Runtime in this preview release: + +- [Feature](#feature) + +.NET Runtime updates in .NET 10: + +- [What's new in .NET 10](https://learn.microsoft.com/dotnet/core/whats-new/dotnet-10/overview) documentation + +## Feature + +Something about the feature diff --git a/release-notes/10.0/preview/preview4/sdk.md b/release-notes/10.0/preview/preview4/sdk.md new file mode 100644 index 0000000000..c3061d3988 --- /dev/null +++ b/release-notes/10.0/preview/preview4/sdk.md @@ -0,0 +1,13 @@ +# .NET SDK in .NET 10 Preview 4 - Release Notes + +Here's a summary of what's new in the .NET SDK in this preview release: + +- [Feature](#feature) + +.NET SDK updates in .NET 10: + +- [What's new in .NET 10](https://learn.microsoft.com/dotnet/core/whats-new/dotnet-10/overview) documentation + +## Feature + +Something about the feature diff --git a/release-notes/10.0/preview/preview4/visualbasic.md b/release-notes/10.0/preview/preview4/visualbasic.md new file mode 100644 index 0000000000..a605d2cb2b --- /dev/null +++ b/release-notes/10.0/preview/preview4/visualbasic.md @@ -0,0 +1,6 @@ +# Visual Basic updates in .NET 10 Preview 4 - Release Notes + +This preview release does not contain new Visual Basic features. Please checkout the lastest documentation: + +- [What's new in Visual Basic](https://learn.microsoft.com/dotnet/visual-basic/whats-new/) documentation +- [Breaking changes](https://learn.microsoft.com/dotnet/visual-basic/whats-new/breaking-changes) diff --git a/release-notes/10.0/preview/preview4/winforms.md b/release-notes/10.0/preview/preview4/winforms.md new file mode 100644 index 0000000000..943f728853 --- /dev/null +++ b/release-notes/10.0/preview/preview4/winforms.md @@ -0,0 +1,14 @@ +# Windows Forms in .NET 10 Preview 4 - Release Notes + +Here's a summary of what's new in Windows Forms in this preview release: + +- [Feature](#feature) + +## Windows Forms updates in .NET 10 + +- [What's new in Windows Forms in .NET 10](https://learn.microsoft.com/dotnet/desktop/winforms/whats-new/net100) documentation. +- [Issues List for Windows Forms in .NET 10 Preview 2](https://github.com/dotnet/winforms/issues?q=is%3Aissue%20milestone%3A%2210.0%20Preview2%22%20) + +## Feature + +Something about the feature diff --git a/release-notes/10.0/preview/preview4/wpf.md b/release-notes/10.0/preview/preview4/wpf.md new file mode 100644 index 0000000000..6fc900c8f6 --- /dev/null +++ b/release-notes/10.0/preview/preview4/wpf.md @@ -0,0 +1,13 @@ +# WPF in .NET 10 Preview 4 - Release Notes + +Here's a summary of what's new in WPF in this preview release: + +- [Feature](#feature) + +WPF updates in .NET 10: + +- [What's new in WPF in .NET 10](https://learn.microsoft.com/dotnet/desktop/wpf/whats-new/net100) documentation. + +## Feature + +Something about the feature From de5b836a96ccc67d231b0f4d345ab368b6230e7b Mon Sep 17 00:00:00 2001 From: maumar Date: Sun, 20 Apr 2025 02:20:48 -0700 Subject: [PATCH 2/5] adding release notes for ef core --- release-notes/10.0/preview/preview4/efcore.md | 147 ++++++++++++++++-- 1 file changed, 138 insertions(+), 9 deletions(-) diff --git a/release-notes/10.0/preview/preview4/efcore.md b/release-notes/10.0/preview/preview4/efcore.md index 8e6e616b50..03b84ac391 100644 --- a/release-notes/10.0/preview/preview4/efcore.md +++ b/release-notes/10.0/preview/preview4/efcore.md @@ -2,7 +2,8 @@ Here's a summary of what's new in Entity Framework Core in this preview release: -- [Improved experience when evolving the model on Azure Cosmos DB for NoSQL](#improved-experience-when-evolving-the-model-on-azure-cosmos-db-for-nosql) +- [Full-text search support on Azure Cosmos DB for NoSQL](#full-text-search-support-on-azure-cosmos-db-for-nosql) +- [Vector similarity search exits preview](#vector-similarity-search-exits-preview) - [Small improvements](#small-improvements) Entity Framework Core 10 updates: @@ -10,21 +11,149 @@ Entity Framework Core 10 updates: - [What's new in Entity Framework Core 10](https://learn.microsoft.com/ef/core/what-is-new/ef-core-10.0/whatsnew) documentation - [Breaking change in Entity Framework Core 10](https://learn.microsoft.com/ef/core/what-is-new/ef-core-10.0/breaking-changes) -## Improved experience when evolving the model on Azure Cosmos DB for NoSQL +## Full-text search support on Azure Cosmos DB for NoSQL -In previous versions of EF Core, evolving the model when using Azure Cosmos DB was quite painful. Specifically, when adding a new required property to the entity, EF would no longer be able to materialize that entity. The reason was that EF expected a value for the new property (since it was required), but the document created before the change didn't contain those values. The workaround was to mark the property as optional first, manually add default values for the property, and only then change it to required. +Azure Cosmos DB now offers support for [full-text search](/azure/cosmos-db/gen-ai/full-text-search). It enables efficient and effective text searches using advanced techniques like stemming, as well as evaluating the relevance of documents to a given search query. It can be used in combination with vector search (i.e. hybrid search) to improve the accuracy of responses in some AI scenarios. +EF Core 10 is adding support for this feature allowing for modeling the database with full-text search enabled properties and using full-text search functions inside queries targeting Azure Cosmos DB. -In EF 10 Preview 4 we improved this experience - EF will now materialize a default value for a required property, if no data is present for it in the document, rather than throw. +### Model configuration + +A property can be configured inside `OnModelCreating` to use full-text search by enabling it for the property and defining a full-text index: + +```c# +public class Blog +{ + ... + + public string Contents { get; set; } +} + +public class BloggingContext +{ + ... + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.Entity(b => + { + b.Property(x => x.Contents).EnableFullTextSearch(); + b.HasIndex(x => x.Contents).IsFullTextIndex(); + }); + } +} +``` + +> [!NOTE] +> Configuring the index is not mandatory, but it is recommended as it greatly improves performance of full-text search queries. + +Full-text search operations are language specific, using American English (`en-US`) by default. You can customize the language for individual properties as part of `EnableFullTextSearch` call: + +```c# + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.Entity(b => + { + b.Property(x => x.Contents).EnableFullTextSearch(); + b.HasIndex(x => x.Contents).IsFullTextIndex(); + b.Property(x => x.ContentsGerman).EnableFullTextSearch("de-DE"); + b.HasIndex(x => x.ContentsGerman).IsFullTextIndex(); + }); + } +``` + +You can also set a default language for the container - unless overridden in the `EnableFullTextSearch` method, all full-text properties inside the container will use that language. + +```c# + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.Entity(b => + { + b.HasDefaultFullTextLanguage("de-DE"); + b.Property(x => x.ContentsEnglish).EnableFullTextSearch("en-US"); + b.HasIndex(x => x.ContentsEnglish).IsFullTextIndex(); + b.Property(x => x.ContentsGerman).EnableFullTextSearch(); + b.HasIndex(x => x.ContentsGerman).IsFullTextIndex(); + b.Property(x => x.TagsGerman).EnableFullTextSearch(); + b.HasIndex(x => x.TagsGerman).IsFullTextIndex(); + }); + } +``` + +> [!NOTE] +> Configuring the index is not mandatory, but it is recommended as it greatly improves performance of full-text search queries. + +### Querying + +As part of the full-text search feature, Azure Cosmos DB introduced several built-in functions which allow for efficient querying of content inside the full-text search enabled properties. These functions are: [`FullTextContains`](/azure/cosmos-db/nosql/query/fulltextcontains), [`FullTextContainsAll`](/azure/cosmos-db/nosql/query/fulltextcontainsall), [`FullTextContainsAny`](/azure/cosmos-db/nosql/query/fulltextcontainsany), which look for specific keyword or keywords and [`FullTextScore`](/azure/cosmos-db/nosql/query/fulltextscore), which returns [BM25 score](https://en.wikipedia.org/wiki/Okapi_BM25) based on provided keywords. + +> [!NOTE] +> `FullTextScore` can only be used inside `OrderBy` to rank the documents based on the score. + +EF Core exposes these functions as part of `EF.Functions` so they can be used in queries: + +```c# +var cosmosBlogs = await context.Blogs.Where(x => EF.Functions.FullTextContainsAll(x.Contents, "database", "cosmos")).ToListAsync(); + +var keywords = new string[] { "AI", "agent", "breakthrough" }; +var mostInteresting = await context.Blogs.OrderBy(x => EF.Functions.FullTextScore(x.Contents, keywords)).Take(5).ToListAsync(); +``` + +### Hybrid search + +Full-text search can be used with vector search in the same query (i.e. hybrid search), by combining results of `FullTextScore` and `VectorDistance` functions. It can be done using the [`RRF`](/azure/cosmos-db/nosql/query/rrf) (Reciprocal Rank Fusion) function, which EF Core also provides inside `EF.Functions`: + +```c# +public class Blog +{ + ... + + public float[] Vector { get; set; } + public string Contents { get; set; } +} + +public class BloggingContext +{ + ... + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.Entity(b => + { + b.Property(x => x.Contents).EnableFullTextSearch(); + b.HasIndex(x => x.Contents).IsFullTextIndex(); + + b.Property(x => x.Vector).IsVectorProperty(DistanceFunction.Cosine, dimensions: 1536); + b.HasIndex(x => x.Vector).IsVectorIndex(VectorIndexType.Flat); + }); + } +} + +float[] myVector = /* generate vector data from text, image, etc. */ +var hybrid = await context.Blogs.OrderBy(x => EF.Functions.Rrf( + EF.Functions.FullTextScore(x.Contents, "database"), + EF.Functions.VectorDistance(x.Vector, myVector))) + .Take(10) + .ToListAsync(); +``` + +> [!TIP] +> You can combine more than two scoring functions inside `Rrf` call, as well as using only `FullTextScore`, or only `VectorDistance`. + +## Vector similarity search exits preview + +In EF9 we added experimental support for [vector similarity search](/ef/core/what-is-new/ef-core-9.0/whatsnew#vector-similarity-search-preview). In EF Core 10, vector similarity search support is no longer experimental. We have also made some improvements to the feature: + +- EF Core can now generate containers with vector properties defined on owned reference entities. Containers with vector properties defined on owned collections still have to be created by other means. However, they can be used in queries. +- Model building APIs have been renamed. A vector property can now be configured using the `IsVectorProperty` method, and vector index can be configured using the `IsVectorIndex` method. ## Small improvements -- Redact inlined constants from log when sensitive logging is off ([#35724](https://github.com/dotnet/efcore/pull/35724)). -- Improve LoadExtension to work correctly with dotnet run and lib* named libs ([#35617](https://github.com/dotnet/efcore/pull/35617), contributed by [@krwq](https://github.com/krwq)). +- Translate `COALESCE` as `ISNULL` ([#34171](https://github.com/dotnet/efcore/pull/34171), contributed by [@ranma42](https://github.com/ranma42)). ## Everything else in Preview 4 Preview 4 contains: -- [4 enhancements](https://github.com/dotnet/efcore/issues?q=is%3Aissue%20is%3Aclosed%20label%3Apreview-3%20(milestone%3A9.0.5%20OR%20milestone%3A10.0.0)%20label%3Atype-enhancement) -- [2 regression bug fixes](https://github.com/dotnet/efcore/issues?q=is%3Aissue%20is%3Aclosed%20label%3Apreview-3%20(milestone%3A9.0.5%20OR%20milestone%3A10.0.0)%20label%3Atype-bug%20label%3Aregression) -- [2 non-regression bug fixes](https://github.com/dotnet/efcore/issues?q=is%3Aissue%20is%3Aclosed%20label%3Apreview-3%20(milestone%3A10.0.0)%20label%3Atype-bug%20-label%3Aregression) +- [10 enhancements](https://github.com/dotnet/efcore/issues?q=is%3Aissue%20state%3Aclosed%20label%3Apreview-4%20milestone%3A10.0.0%20label%3Atype-enhancement) +- [2 regression bug fixes](https://github.com/dotnet/efcore/issues?q=is%3Aissue%20state%3Aclosed%20label%3Apreview-4%20milestone%3A10.0.0%20label%3Atype-bug%20label%3Aregression) +- [3 non-regression bug fixes](https://github.com/dotnet/efcore/issues?q=is%3Aissue%20state%3Aclosed%20label%3Apreview-4%20milestone%3A10.0.0%20label%3Atype-bug%20-label%3Aregression%20) From a17fd89e1afb1877f667a2920219c6b0360fb802 Mon Sep 17 00:00:00 2001 From: maumar Date: Tue, 22 Apr 2025 12:06:34 -0700 Subject: [PATCH 3/5] updated cosmos section of ef docs and added missing small improvements --- release-notes/10.0/preview/preview4/efcore.md | 102 +++--------------- 1 file changed, 17 insertions(+), 85 deletions(-) diff --git a/release-notes/10.0/preview/preview4/efcore.md b/release-notes/10.0/preview/preview4/efcore.md index 03b84ac391..19c5cf0237 100644 --- a/release-notes/10.0/preview/preview4/efcore.md +++ b/release-notes/10.0/preview/preview4/efcore.md @@ -13,12 +13,10 @@ Entity Framework Core 10 updates: ## Full-text search support on Azure Cosmos DB for NoSQL -Azure Cosmos DB now offers support for [full-text search](/azure/cosmos-db/gen-ai/full-text-search). It enables efficient and effective text searches using advanced techniques like stemming, as well as evaluating the relevance of documents to a given search query. It can be used in combination with vector search (i.e. hybrid search) to improve the accuracy of responses in some AI scenarios. +Azure Cosmos DB now offers support for [full-text search](/azure/cosmos-db/gen-ai/full-text-search). It enables efficient and effective text searches, as well as evaluating the relevance of documents to a given search query. It can be used in combination with vector search to improve the accuracy of responses in some AI scenarios. EF Core 10 is adding support for this feature allowing for modeling the database with full-text search enabled properties and using full-text search functions inside queries targeting Azure Cosmos DB. -### Model configuration - -A property can be configured inside `OnModelCreating` to use full-text search by enabling it for the property and defining a full-text index: +Here is a basic EF model configuration enabling full-text search on one of the properties: ```c# public class Blog @@ -43,91 +41,21 @@ public class BloggingContext } ``` -> [!NOTE] -> Configuring the index is not mandatory, but it is recommended as it greatly improves performance of full-text search queries. - -Full-text search operations are language specific, using American English (`en-US`) by default. You can customize the language for individual properties as part of `EnableFullTextSearch` call: +Once the model is configured, we can use full-text search operations in queries using methods provided in `EF.Functions`: ```c# - protected override void OnModelCreating(ModelBuilder modelBuilder) - { - modelBuilder.Entity(b => - { - b.Property(x => x.Contents).EnableFullTextSearch(); - b.HasIndex(x => x.Contents).IsFullTextIndex(); - b.Property(x => x.ContentsGerman).EnableFullTextSearch("de-DE"); - b.HasIndex(x => x.ContentsGerman).IsFullTextIndex(); - }); - } +var cosmosBlogs = await context.Blogs.Where(x => EF.Functions.FullTextContains(x.Contents, "cosmos")).ToListAsync(); ``` -You can also set a default language for the container - unless overridden in the `EnableFullTextSearch` method, all full-text properties inside the container will use that language. - -```c# - protected override void OnModelCreating(ModelBuilder modelBuilder) - { - modelBuilder.Entity(b => - { - b.HasDefaultFullTextLanguage("de-DE"); - b.Property(x => x.ContentsEnglish).EnableFullTextSearch("en-US"); - b.HasIndex(x => x.ContentsEnglish).IsFullTextIndex(); - b.Property(x => x.ContentsGerman).EnableFullTextSearch(); - b.HasIndex(x => x.ContentsGerman).IsFullTextIndex(); - b.Property(x => x.TagsGerman).EnableFullTextSearch(); - b.HasIndex(x => x.TagsGerman).IsFullTextIndex(); - }); - } -``` - -> [!NOTE] -> Configuring the index is not mandatory, but it is recommended as it greatly improves performance of full-text search queries. - -### Querying - -As part of the full-text search feature, Azure Cosmos DB introduced several built-in functions which allow for efficient querying of content inside the full-text search enabled properties. These functions are: [`FullTextContains`](/azure/cosmos-db/nosql/query/fulltextcontains), [`FullTextContainsAll`](/azure/cosmos-db/nosql/query/fulltextcontainsall), [`FullTextContainsAny`](/azure/cosmos-db/nosql/query/fulltextcontainsany), which look for specific keyword or keywords and [`FullTextScore`](/azure/cosmos-db/nosql/query/fulltextscore), which returns [BM25 score](https://en.wikipedia.org/wiki/Okapi_BM25) based on provided keywords. - -> [!NOTE] -> `FullTextScore` can only be used inside `OrderBy` to rank the documents based on the score. - -EF Core exposes these functions as part of `EF.Functions` so they can be used in queries: - -```c# -var cosmosBlogs = await context.Blogs.Where(x => EF.Functions.FullTextContainsAll(x.Contents, "database", "cosmos")).ToListAsync(); +The following full-text operations are currently supported: [`FullTextContains`](/azure/cosmos-db/nosql/query/fulltextcontains), [`FullTextContainsAll`](/azure/cosmos-db/nosql/query/fulltextcontainsall), [`FullTextContainsAny`](/azure/cosmos-db/nosql/query/fulltextcontainsany), [`FullTextScore`](/azure/cosmos-db/nosql/query/fulltextscore). -var keywords = new string[] { "AI", "agent", "breakthrough" }; -var mostInteresting = await context.Blogs.OrderBy(x => EF.Functions.FullTextScore(x.Contents, keywords)).Take(5).ToListAsync(); -``` +For more information on Cosmos full-text search, see the [docs](/ef/core/providers/cosmos/full-text-search). ### Hybrid search -Full-text search can be used with vector search in the same query (i.e. hybrid search), by combining results of `FullTextScore` and `VectorDistance` functions. It can be done using the [`RRF`](/azure/cosmos-db/nosql/query/rrf) (Reciprocal Rank Fusion) function, which EF Core also provides inside `EF.Functions`: +EF Core now supports [`RRF`](/azure/cosmos-db/nosql/query/rrf) (Reciprocal Rank Fusion) function, which combines vector similarity search and full-text search (i.e. hybrid search). Here is an example query using hybrid search: ```c# -public class Blog -{ - ... - - public float[] Vector { get; set; } - public string Contents { get; set; } -} - -public class BloggingContext -{ - ... - - protected override void OnModelCreating(ModelBuilder modelBuilder) - { - modelBuilder.Entity(b => - { - b.Property(x => x.Contents).EnableFullTextSearch(); - b.HasIndex(x => x.Contents).IsFullTextIndex(); - - b.Property(x => x.Vector).IsVectorProperty(DistanceFunction.Cosine, dimensions: 1536); - b.HasIndex(x => x.Vector).IsVectorIndex(VectorIndexType.Flat); - }); - } -} - float[] myVector = /* generate vector data from text, image, etc. */ var hybrid = await context.Blogs.OrderBy(x => EF.Functions.Rrf( EF.Functions.FullTextScore(x.Contents, "database"), @@ -136,24 +64,28 @@ var hybrid = await context.Blogs.OrderBy(x => EF.Functions.Rrf( .ToListAsync(); ``` -> [!TIP] -> You can combine more than two scoring functions inside `Rrf` call, as well as using only `FullTextScore`, or only `VectorDistance`. +For more information on Cosmos hybrid search, see the [docs](/ef/core/providers/cosmos/full-text-search?#hybrid-search). -## Vector similarity search exits preview +### Vector similarity search exits preview -In EF9 we added experimental support for [vector similarity search](/ef/core/what-is-new/ef-core-9.0/whatsnew#vector-similarity-search-preview). In EF Core 10, vector similarity search support is no longer experimental. We have also made some improvements to the feature: +In EF9 we added experimental support for vector similarity search. In EF Core 10, vector similarity search support is no longer experimental. We have also made some improvements to the feature: - EF Core can now generate containers with vector properties defined on owned reference entities. Containers with vector properties defined on owned collections still have to be created by other means. However, they can be used in queries. - Model building APIs have been renamed. A vector property can now be configured using the `IsVectorProperty` method, and vector index can be configured using the `IsVectorIndex` method. +For more information on Cosmos vector search, see the [docs](/ef/core/providers/cosmos/vector-search). + ## Small improvements - Translate `COALESCE` as `ISNULL` ([#34171](https://github.com/dotnet/efcore/pull/34171), contributed by [@ranma42](https://github.com/ranma42)). +- Support for some string functions taking `char` as arguments ([#34999](https://github.com/dotnet/efcore/pull/34999), contributed by [@ChrisJollyAU](https://github.com/ChrisJollyAU)). +- Support for `MAX`/`MIN`/`ORDER BY` using `decimal` on SQLite ([#35606](https://github.com/dotnet/efcore/pull/35606), contributed by [@ranma42](https://github.com/ranma42)). +- Changed AsyncLocal to ThreadId for better Lazy loader performance ([#35835](https://github.com/dotnet/efcore/pull/35835), contributed by [@henriquewr](https://github.com/henriquewr)). ## Everything else in Preview 4 Preview 4 contains: -- [10 enhancements](https://github.com/dotnet/efcore/issues?q=is%3Aissue%20state%3Aclosed%20label%3Apreview-4%20milestone%3A10.0.0%20label%3Atype-enhancement) +- [11 enhancements](https://github.com/dotnet/efcore/issues?q=is%3Aissue%20state%3Aclosed%20label%3Apreview-4%20milestone%3A10.0.0%20label%3Atype-enhancement) - [2 regression bug fixes](https://github.com/dotnet/efcore/issues?q=is%3Aissue%20state%3Aclosed%20label%3Apreview-4%20milestone%3A10.0.0%20label%3Atype-bug%20label%3Aregression) -- [3 non-regression bug fixes](https://github.com/dotnet/efcore/issues?q=is%3Aissue%20state%3Aclosed%20label%3Apreview-4%20milestone%3A10.0.0%20label%3Atype-bug%20-label%3Aregression%20) +- [3 non-regression bug fixes](https://github.com/dotnet/efcore/issues?q=is%3Aissue%20state%3Aclosed%20label%3Apreview-4%20milestone%3A10.0.0%20label%3Atype-bug%20-label%3Aregression%20) \ No newline at end of file From 7d3b5aecd6f21ec9edbe9e58aee2488137e20b8d Mon Sep 17 00:00:00 2001 From: maumar Date: Tue, 22 Apr 2025 12:09:13 -0700 Subject: [PATCH 4/5] fixed headings --- release-notes/10.0/preview/preview4/efcore.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release-notes/10.0/preview/preview4/efcore.md b/release-notes/10.0/preview/preview4/efcore.md index 19c5cf0237..1f51549dba 100644 --- a/release-notes/10.0/preview/preview4/efcore.md +++ b/release-notes/10.0/preview/preview4/efcore.md @@ -51,7 +51,7 @@ The following full-text operations are currently supported: [`FullTextContains`] For more information on Cosmos full-text search, see the [docs](/ef/core/providers/cosmos/full-text-search). -### Hybrid search +## Hybrid search EF Core now supports [`RRF`](/azure/cosmos-db/nosql/query/rrf) (Reciprocal Rank Fusion) function, which combines vector similarity search and full-text search (i.e. hybrid search). Here is an example query using hybrid search: @@ -66,7 +66,7 @@ var hybrid = await context.Blogs.OrderBy(x => EF.Functions.Rrf( For more information on Cosmos hybrid search, see the [docs](/ef/core/providers/cosmos/full-text-search?#hybrid-search). -### Vector similarity search exits preview +## Vector similarity search exits preview In EF9 we added experimental support for vector similarity search. In EF Core 10, vector similarity search support is no longer experimental. We have also made some improvements to the feature: From e34d64186f1956826eefc1a3acf4645b19192c24 Mon Sep 17 00:00:00 2001 From: maumar Date: Tue, 22 Apr 2025 12:20:54 -0700 Subject: [PATCH 5/5] fix linter error in ef docs --- release-notes/10.0/preview/preview4/efcore.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-notes/10.0/preview/preview4/efcore.md b/release-notes/10.0/preview/preview4/efcore.md index 1f51549dba..5bbff6e1ed 100644 --- a/release-notes/10.0/preview/preview4/efcore.md +++ b/release-notes/10.0/preview/preview4/efcore.md @@ -88,4 +88,4 @@ Preview 4 contains: - [11 enhancements](https://github.com/dotnet/efcore/issues?q=is%3Aissue%20state%3Aclosed%20label%3Apreview-4%20milestone%3A10.0.0%20label%3Atype-enhancement) - [2 regression bug fixes](https://github.com/dotnet/efcore/issues?q=is%3Aissue%20state%3Aclosed%20label%3Apreview-4%20milestone%3A10.0.0%20label%3Atype-bug%20label%3Aregression) -- [3 non-regression bug fixes](https://github.com/dotnet/efcore/issues?q=is%3Aissue%20state%3Aclosed%20label%3Apreview-4%20milestone%3A10.0.0%20label%3Atype-bug%20-label%3Aregression%20) \ No newline at end of file +- [3 non-regression bug fixes](https://github.com/dotnet/efcore/issues?q=is%3Aissue%20state%3Aclosed%20label%3Apreview-4%20milestone%3A10.0.0%20label%3Atype-bug%20-label%3Aregression%20)