Skip to content

Collection initilization with EF Core 7 #28847

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

Closed
ErikEJ opened this issue Aug 23, 2022 · 2 comments
Closed

Collection initilization with EF Core 7 #28847

ErikEJ opened this issue Aug 23, 2022 · 2 comments

Comments

@ErikEJ
Copy link
Contributor

ErikEJ commented Aug 23, 2022

This used to be HashSet, but is now List - why?

public virtual ICollection<Order> Orders { get; } = new List<Order>();

@ajcvickers
Copy link
Contributor

HashSet is a good choice when navigations contain a lot of entities. Over the years, experience has shown that List is probably better in the code for majority of uses since it preserves ordering, allows indexing, etc., and it's actually faster for a small number of items. Since these are templates, it's easy to change the template to get back to HashSet if desired.

@ErikEJ ErikEJ closed this as not planned Won't fix, can't repro, duplicate, stale Aug 23, 2022
@ErikEJ
Copy link
Contributor Author

ErikEJ commented Aug 23, 2022

I am doing some research for this: ErikEJ/EFCorePowerTools#1499

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