Question: why do you not allow IImmutableList<T>
for collection navigational properties with backing fields?
#21176
Milestone
IImmutableList<T>
for collection navigational properties with backing fields?
#21176
This is a question, rather than a request for a change!
I want to create entity classes where no properties can be changed outside the class (DDD-styled class). For instance:
From my testing I know that collection navigational properties can use the following types -
IEnumerable<T>
IReadOnlyCollection<T>
I want to move away from using
IEnumerable<T>
, as it has (small) performance problems when you call it multiple times. I would like to useIImmutableList<T>
as that sounds like a better type because it ensures that a) it takes a copy (AsReadOnly
doesn't take a copy) and, b) makes parallel operations work better. But I get I useIImmutableList<T>
.IImmutableList<T>
seems to tick all the boxes by supportingIEnumerable<T>
,ICollection<T>
,IList<T>
. AlsoAsReadOnly()
doesn't work with a HashSet, butToImmutableList()
does. so why does EF Core not support it? Is there something fundamental or just the way it is written?NOTE: I have tried this on EF Core 3.1 and 5-preview4
The text was updated successfully, but these errors were encountered: