Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Primitive Collection Must Implement IList #4715

Open
chapych opened this issue Apr 18, 2024 · 0 comments
Open

Primitive Collection Must Implement IList #4715

chapych opened this issue Apr 18, 2024 · 0 comments

Comments

@chapych
Copy link

chapych commented Apr 18, 2024

Type of issue

Missing information

Description

When adding primitive collections of IEnumerable returned by LINQ without casting them to List, Array, etc., the internal method Snapshot(IEnumerable source, ValueComparer elementComparer) is invoked after the SaveChanges() call, which checks if the input parameter is an IList.

In the scenario mentioned, this method throws an exception: "The type some_type cannot be used as a primitive collection because it is not an array and does not implement 'IList'. Collections of primitive types must be arrays or ordered lists."

It may be beneficial to note this peculiarity.

Page URL

https://learn.microsoft.com/en-us/ef/core/what-is-new/ef-core-8.0/whatsnew#primitive-collections

Content source URL

https://github.com/dotnet/EntityFramework.Docs/blob/main/entity-framework/core/what-is-new/ef-core-8.0/whatsnew.md

Document Version Independent Id

97203c5d-fe52-b71e-dcb3-71c9492b4e04

Article author

@ajcvickers

@ajcvickers ajcvickers added this to the Backlog milestone May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants