Entity Framework >= 7.0 provides HashSet<T>
as implementation to 1-n
and m-n
associations (i.e. collections). In my case, these associations are typed as ICollection<T>
, and HashSet<T>
doesn't work for me, because JSON PATCH
(RFC 6902) standard, it requires list data structure semantics (e.g. indexed collection, FIFO, etc.), when it comes to patching nested collections (i.e. arrays).
Therefore, I'd like to avoid a massive refactor which would involve typing associations as IList<T>
, to leave DTOs agnostic to JSON PATCH implementation details.
Is it possible to configure Entity Framework Core to use List<T>
instead of HashSet<T>
by configuration (Code First)?