Skip to content

Commit cb8dd73

Browse files
rojiCopilot
andcommitted
Document complex type property configuration via lambda chaining
Add what's new section for dotnet/efcore#31236, showing how EF Core 11 allows configuring complex type properties directly via chained member access (e.g. e => e.Details.Description) instead of requiring explicit ComplexProperty().Property() calls. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 33a6ce6 commit cb8dd73

1 file changed

Lines changed: 23 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: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,29 @@ For more information on inheritance mapping strategies, see [Inheritance](xref:c
8383

8484
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).
8585

86+
<a name="complex-types-property-chaining"></a>
87+
88+
### Configuring complex type properties via lambda chaining
89+
90+
Previously, configuring a property on a complex type required first calling `ComplexProperty` to get the complex type builder, and then calling `Property` on it:
91+
92+
```csharp
93+
modelBuilder.Entity<MyEntity>()
94+
.ComplexProperty(e => e.Details)
95+
.Property(d => d.Description)
96+
.HasMaxLength(500);
97+
```
98+
99+
EF Core 11 now allows configuring complex type properties directly by chaining member access in the lambda expression passed to `Property`:
100+
101+
```csharp
102+
modelBuilder.Entity<MyEntity>()
103+
.Property(e => e.Details.Description)
104+
.HasMaxLength(500);
105+
```
106+
107+
This simplifies model configuration by removing the need to explicitly navigate through intermediate complex type builders to reach the property you want to configure.
108+
86109
<a name="complex-types-stabilization"></a>
87110

88111
### Stabilization and bug fixes

0 commit comments

Comments
 (0)