Skip to content

Use immutable collections in query expressions #1027

Closed
@bart-degreed

Description

@bart-degreed

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions