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

T4 template for scaffolding data-binding entity types using INotifyPropertyChanged etc. #15515

Open
Tracked by #22948
ComptonAlvaro opened this issue Apr 28, 2019 · 5 comments
Labels
area-scaffolding customer-reported punted-for-7.0 Originally planned for the EF Core 7.0 (EF7) release, but moved out due to resource constraints. type-enhancement
Milestone

Comments

@ComptonAlvaro
Copy link

Until now, i get the entities using this command:

Scaffold-DbContext "Server=localhost\SQLExpress;Database=MiBaseDatos;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models

But I see that the default collection is hashset, but I know that EF Core can work with property changes, and there is a ObservableHashSet collection, but I would like to know if there is some way to set the type of collection that I want, because if not, I would have to change one by one the collections in all my entities.

Thanks.

@ErikEJ
Copy link
Contributor

ErikEJ commented Apr 28, 2019

EF Core Power Tools with Handlebars templates will enable you to do this.

@ajcvickers
Copy link
Member

Related to #4038, but it could be useful to have a mode that scaffolds for data-binding. However, in that case ObservableHashSet would not be appropriate--we would scaffold ObservableCollection for WPF/UWP, and ObservableBackedBindingList for Win Forms.

@ajcvickers ajcvickers added this to the Backlog milestone May 3, 2019
@ajcvickers ajcvickers changed the title Is it possible set in scaffold to use ObservableHashSet instead of hashset? Consider a scaffolding mode that generates data-binding entity types May 3, 2019
@ComptonAlvaro
Copy link
Author

Why would it be the reson to use ObservableCollection? Now it is used a hashset for collections because I guess for performance is better because because to get an element it is O(1), but if now the collections will be ObservableCollections, wouldn't it make that to lose performance?

Just I am wondering why ObserbableHashSet is not appropiate in this case.

Thanks.

@ajcvickers
Copy link
Member

@ComptonAlvaro It's because ObservableHashSet does not have a stable order. It's fine for notifications, but data binding requires that the order of other items not change when a different item is inserted or removed.

@ComptonAlvaro
Copy link
Author

Thanks for the answer, it is good to learn new things.

@ajcvickers ajcvickers modified the milestones: Backlog, 7.0.0 Oct 22, 2021
@ajcvickers ajcvickers added punted-for-7.0 Originally planned for the EF Core 7.0 (EF7) release, but moved out due to resource constraints. and removed propose-punt labels Apr 23, 2022
@ajcvickers ajcvickers modified the milestones: 7.0.0, Backlog Apr 23, 2022
@ajcvickers ajcvickers self-assigned this Oct 25, 2022
@ajcvickers ajcvickers changed the title Consider a scaffolding mode that generates data-binding entity types T4 template for scaffolding data-binding entity types using INotifyPropertyChanged etc. Oct 26, 2022
@bricelam bricelam removed their assignment Jul 8, 2023
@ajcvickers ajcvickers removed their assignment Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-scaffolding customer-reported punted-for-7.0 Originally planned for the EF Core 7.0 (EF7) release, but moved out due to resource constraints. type-enhancement
Projects
None yet
Development

No branches or pull requests

4 participants