You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow keys and indexes to use properties on non-collection complex types #31246
Reacted by Victor Irzak, Frank Buckley, Marcelo Volmaro, Alexandre Murari Junior, michelbieleveld, Stefan Kaufhold, Marc Chouteau, Andrii Bezzub, Cristian Toma, HamitKARAHAN and 215 more
Reacted by Danilo A., Alex Mitrakis, nev-21, Maksym Stakanov, Hans Krogh Thomsen, Pavel Voronin, 李發財, Ricardo Groß, hanzllcc and Mariano Santoro
This issue is in the Backlog milestone. This means that it is not planned for the next release (EF Core 9.0). We will re-assess the backlog following the this release and consider this item at that time. However, keep in mind that there are many other high priority features with which it will be competing for resources. Make sure to vote (👍) for this issue if it is important to you.
Reacted by ldeluigi, Danilo A., achyzh, boom-morten, Aleksandar Jovanov, 李發財, mayorovp, Matthias Bromisch, Ivan Seleznov, Adnan AlBeda and 35 more
This would be really useful. Complex Types are needed for hiding functionality and managing the relationship of fields in the database.
For example say I have labels in my data, and some but not all of these labels have related data. I would like to use a complex type to manage the interaction of the text label vs the referenced data. If I cannot index the text label then it is impossible to perform the required operations.
In my particular situation I don’t need a composite key, just a key on one property within the complex type.
This has just become an issue for us, and I'm not sure how to proceed. Our database team has asked us to add some indexes in order to improve performance, and the list of indexes they've requested includes some complex type properties (as included columns).
For example (simplified for illustration):
CREATEINDEXrequested_index_1ON [Companies] ([OwnerId]) INCLUDE ([OwnerAddress_City])
Since OwnerAddress is an Address value object, I have no way of adding this index in the DbContext, right? I would need something like this, which doesn't work:
If the indexes are just applied on the database side, will that affect future EF Migrations? What if I skip the DbContext, but manually add these to a Migration using .CreateIndex()?
Activity
ldeluigi commentedon May 14, 2024
danilo73r commentedon Jun 15, 2024
hanzllcc commentedon Jul 1, 2024
arm-grigoryan commentedon Jul 2, 2024
ajcvickers commentedon Jul 3, 2024
This issue is in the Backlog milestone. This means that it is not planned for the next release (EF Core 9.0). We will re-assess the backlog following the this release and consider this item at that time. However, keep in mind that there are many other high priority features with which it will be competing for resources. Make sure to vote (👍) for this issue if it is important to you.
nev-21 commentedon Nov 26, 2024
Hello! This feature is really important for us.
sjb-sjb commentedon Mar 22, 2025
This would be really useful. Complex Types are needed for hiding functionality and managing the relationship of fields in the database.
For example say I have labels in my data, and some but not all of these labels have related data. I would like to use a complex type to manage the interaction of the text label vs the referenced data. If I cannot index the text label then it is impossible to perform the required operations.
In my particular situation I don’t need a composite key, just a key on one property within the complex type.
dougwaldron commentedon Apr 28, 2025
This has just become an issue for us, and I'm not sure how to proceed. Our database team has asked us to add some indexes in order to improve performance, and the list of indexes they've requested includes some complex type properties (as included columns).
For example (simplified for illustration):
Since
OwnerAddressis anAddressvalue object, I have no way of adding this index in the DbContext, right? I would need something like this, which doesn't work:If the indexes are just applied on the database side, will that affect future EF Migrations? What if I skip the
DbContext, but manually add these to a Migration using.CreateIndex()?AndriySvyryd commentedon Apr 28, 2025
That would be the suggested workaround. You'll just need to remember to drop the index if one of the columns is dropped.
dougwaldron commentedon Apr 29, 2025
That's what I'll do then. Thanks! I appreciate the quick reply.
9 remaining items
Support keys and indexes that traverse complex-type properties
Support keys and indexes that traverse complex-type properties
Support keys and indexes that traverse complex-type properties
Support keys and indexes that traverse complex-type properties
Support keys and indexes that traverse complex-type properties
Support keys and indexes that traverse complex-type properties
Support keys and indexes that traverse complex-type properties
Support keys and indexes that traverse complex-type properties
Support keys and indexes that traverse complex-type properties
Support keys and indexes that traverse complex-type properties
Support keys and indexes that traverse complex-type properties (#38192)