dotnet / dotnet/EntityFramework.Docs
Primitive Collection Must Implement IList
- Dominant language
- Mermaid
- Stars
- 1.7k
- Forks
- 2k
- Avg merge
- 7d 23h
- Merged PRs (30d)
- 16
Description
### 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
Contributor guide
Assessment
This issue has not been assessed yet.