-
-
Notifications
You must be signed in to change notification settings - Fork 160
Description
Types that inherit from abstract QueryExpression are designed as immutable data structures, which represent a datastore-agnostic query that is passed onto the data access layer. However, its collection properties are declared as read-only collections, which are thin wrappers around a mutable collection. We should fix that by switching to immutable collections such as IImmutableSet<T> or IImmutableList<T>.
In practice, this does not change behavior, but it does change the signatures of these types, so it is a breaking change in the technical sense. Aside from that, IReadOnlySet<T> did not exist before .NET 5, so we used IReadOnlyCollection<T> instead. We should revisit such cases and decide whether sets are more appropriate (for example, in SparseFieldSetExpression.Attributes). Note that sets do not preserve order, though.