i have watched the tutorial
How Do I: Build a WPF Data Entry Form Using Entity Framework?
i am confused why the need to change a CollectionViewSource/BindingListCollectionView to ObservableCollection/ListCollection
start code:
var
viewSource = (CollectionViewSource) this
.Resources["customersViewSource"
];
var
result = from
cust in
database.Customers
select
cust;
viewSource.Source = result;
view = (BindingListCollectionView)viewSource.View;
to something like (end code )
var customerSource = ((CollectionViewSource)(this.FindResource("CustomerSource")));
var query = from c in db.Customers
where c.City == "Seattle"
select c;
this.CustomerData = new CustomerCollection(query, db);
customerSource.Source = this.CustomerData;
this.View = ((ListCollectionView)(customerSource.View));
also in CustomerCollection
protected override void InsertItem(int index, Customer cust)
{
this.context.AddToCustomers(cust);
base.InsertItem(index, cust);
}
protected override void RemoveItem(int index)
{
this.context.DeleteObject(this[index]);
base.RemoveItem(index);
}
then in here, why the need to insert/delete the customer from the context then from the base collection view? then why dont i need the same for update?
View Complete Post