Keep track of the original query which will implement IQueryable, you can run any further queries you need against that The ObservableCollection should just be for WPF to have something to bind to - its very useful if you want to add a new collection item but not have it pushed to the database before the user has had chance to edit it eg Create a new blank client type var ct = new ClientType() { IsArchived = false, Description = "", Code = "CT000", CanLoginOnline = true }; // Tell the data source to keep track of this object db.ClientTypes. InsertOnSubmit(ct); // Also add the object to the observable collection so that it can immediately be shown in the UI and editted without hitting the db clienttypes. Add(ct).
Keep track of the original query which will implement IQueryable, you can run any further queries you need against that. The ObservableCollection should just be for WPF to have something to bind to - its very useful if you want to add a new collection item but not have it pushed to the database before the user has had chance to edit it. Eg.
// Create a new blank client type var ct = new ClientType() { IsArchived = false, Description = "", Code = "CT000", CanLoginOnline = true }; // Tell the data source to keep track of this object db.ClientTypes. InsertOnSubmit(ct); // Also add the object to the observable collection so that it can immediately be shown in the UI and editted without hitting the db clienttypes. Add(ct).
I have a problem with Linq and ObservableCollections in my WPF application. I've created a very simple SQL database with two tables: User and BankAccounts. The User Table has an one-to-many relationship with the BankAccounts Table.
Next I've created Linq-to-SQL dataclasses, which worked fine ==> the assosiation between the two tables was detected as well. Now suppose I want to add a new BankAccount to each user (not very likely but still). The above works all fine.
The BankAccounts property is automaticly part of the User class, due to the assosiation in the database and Linq DataClasses. However, in my application I first add the query results to an ObservableCollection. Hereby I could use all sorts off databinding and changenotification.
Problem: Within the ObservableCollection I can't do anyting with the users BankAccounts property because it is now of type EntitySet. So I can't do the following statement anymore. Somehow, when queryresults are added to an observablecollection It is not possible to acces the user.
BankAccounts properties anymore. However, it is possible to bind the BankAccounts Property to any control, like a listbox, and it contains the correct data.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.