开发者

Questions regarding How do i tutorial (WPF/Entity Framework/ObservableCollections)

开发者 https://www.devze.com 2023-01-14 04:39 出处:网络
i watched How Do I: Build a WPF Data Entry Form Using Entity Framework? very confused around 15:30. when the presenter said something like

i watched How Do I: Build a WPF Data Entry Form Using Entity Framework?

very confused around 15:30. when the presenter said something like

when you create a LINQ query, we wont get a rich collection ...

whats does she mean my "rich".

the start code looks like... whats wrong with that. even if i change db.Customers.Execute(...) with a LINQ query, the code still works. why the need for a new observable collection and why ListCollectionView instead of BindingListCollection view. whats the diff between the 2

// customerSource is a CollectionViewSource stored in Window.Resources
// db is of type OMSEntities (which is the Entity Collection Name, what does this mean?)
customerSource.Source = db.Customers.Execute(...);
this.view = (BindingListCollectionView) customerSource.View;

the code after looks like (~21:38)

results = from cust in db.Customers ...
customerData = new CustomerCollection(results, db);
customerSource.Source = customerData
view = (Li开发者_开发知识库stCollectionView) customerSource.View;


She means that you'll get back an IEnumerable, which doesn't have any support for two way binding or extra facilities like notifications of add/remove events, that are available in other collection types. So, the code is taking the IEnumerable and putting the results into a "richer" collection type that has those kinds of features.

0

精彩评论

暂无评论...
验证码 换一张
取 消