Open ComptonAlvaro opened 5 years ago
EF Core Power Tools with Handlebars templates will enable you to do this.
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.
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.
@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.
Thanks for the answer, it is good to learn new things.
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.