diff --git a/entity-framework/core/what-is-new/ef-core-11.0/whatsnew.md b/entity-framework/core/what-is-new/ef-core-11.0/whatsnew.md index a6c8aa1b4c..6842144aeb 100644 --- a/entity-framework/core/what-is-new/ef-core-11.0/whatsnew.md +++ b/entity-framework/core/what-is-new/ef-core-11.0/whatsnew.md @@ -77,6 +77,12 @@ This enhancement removes a significant limitation when modeling complex domain h For more information on inheritance mapping strategies, see [Inheritance](xref:core/modeling/inheritance). + + +### Complex types in Azure Cosmos DB + +Complex types are now fully supported in the Azure Cosmos DB provider, embedded as nested JSON objects or arrays. For more information, [see the Cosmos DB section below](#cosmos-complex-types). + ## LINQ and SQL translation @@ -106,6 +112,38 @@ Similarly, `MinByAsync` orders ascending and returns the element with the minimu ## Cosmos DB + + +### Complex types + +EF Core [complex types](xref:core/what-is-new/ef-core-10.0/whatsnew#complex-types) are now fully supported in the Azure Cosmos DB provider; they are embedded as nested JSON objects (or arrays, for collections) within the owning document, with support for queries, inserts, and updates. + +For example, the following configures `ShippingAddress` as a complex type: + +#### [Fluent API](#tab/fluent-api) + +```csharp +modelBuilder.Entity() + .ComplexProperty(o => o.ShippingAddress); +``` + +#### [Data Annotations](#tab/data-annotations) + +```csharp +[ComplexType] +public class ShippingAddress +{ + public required string Street { get; set; } + public required string City { get; set; } +} +``` + +*** + +Complex types are generally a better fit than owned types when mapping to JSON documents: unlike owned types, complex types have value semantics and no identity, which means they work better in scenarios such as comparing two embedded objects within the same document. + +This feature was contributed by [@JoasE](https://github.com/JoasE) - many thanks! + ### Transactional batches