Skip to content

Commit 8f1e5f1

Browse files
Merge pull request #5306 from dotnet/main
Auto Publish – main to live - 2026-03-26 11:00 UTC
2 parents a727ba1 + 5d68c15 commit 8f1e5f1

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

  • entity-framework/core/what-is-new/ef-core-11.0

entity-framework/core/what-is-new/ef-core-11.0/whatsnew.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ This enhancement removes a significant limitation when modeling complex domain h
7777

7878
For more information on inheritance mapping strategies, see [Inheritance](xref:core/modeling/inheritance).
7979

80+
<a name="complex-types-cosmos"></a>
81+
82+
### Complex types in Azure Cosmos DB
83+
84+
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).
85+
8086
## LINQ and SQL translation
8187

8288
<a name="linq-maxby-minby"></a>
@@ -106,6 +112,38 @@ Similarly, `MinByAsync` orders ascending and returns the element with the minimu
106112

107113
## Cosmos DB
108114

115+
<a name="cosmos-complex-types"></a>
116+
117+
### Complex types
118+
119+
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.
120+
121+
For example, the following configures `ShippingAddress` as a complex type:
122+
123+
#### [Fluent API](#tab/fluent-api)
124+
125+
```csharp
126+
modelBuilder.Entity<Order>()
127+
.ComplexProperty(o => o.ShippingAddress);
128+
```
129+
130+
#### [Data Annotations](#tab/data-annotations)
131+
132+
```csharp
133+
[ComplexType]
134+
public class ShippingAddress
135+
{
136+
public required string Street { get; set; }
137+
public required string City { get; set; }
138+
}
139+
```
140+
141+
***
142+
143+
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.
144+
145+
This feature was contributed by [@JoasE](https://github.com/JoasE) - many thanks!
146+
109147
<a name="cosmos-transactional-batches"></a>
110148

111149
### Transactional batches

0 commit comments

Comments
 (0)