efcore.pg icon indicating copy to clipboard operation
efcore.pg copied to clipboard

Make sure we support IList<T>, not just array/List<T>

Open roji opened this issue 2 years ago • 1 comments

roji avatar Feb 07 '24 22:02 roji

@roji, I just noticed this issue and even though I do not know what it is about exactly, I think it is in a similar area as my suggestion #2577. I understand however if this is completely out of scope. As a short summary:

Although allowing IList would already solve my biggest issue with: CA1002: Do not expose generic lists. I am assuming the actually instantiated type would default to List. And could not be overriden / configured?

My request was (at least conceptually) about allowing any list-type, like ObservableCollection. Or ImmutableList, which would require to loosen the required interface even further from IList to IReadOnlyList

Of course "npgsql" can not support instantiating any list-type and types not implementing new(), new(int capacity), ICollection.Add, etc. - like ImmutableList - require special instantiation anyway. Preferably this could be configured through HasPostgresArrayConversion (with where TProperty : IReadOnlyList<TElementProperty>). Although of course this is already possible with INpgsqlArrayConverter and is a good enough solution.

Thank you for your time.

sethzollinger avatar Jun 18 '24 08:06 sethzollinger