Just how do you create an ObservableCollection from a Linq query?
Not easily is the answer.
If you are using WCF as part of your multi-tier strategy, then you can employ a trick that converts your generated Linq for Sql EntitySet classes into ObservableCollection classes. See a previous post of mine for details.
If you are not using WCF, then like me you’re a bit stuck – you seem to have to do it manually. For each access you need to convert it to a non Linq business object class, and crucially all it’s properties that contain lists.
I have here an example from the AdventureWorks database where the Products List is populated from the database into a ProductModel class, and I show how to do this with a couple of sub properties and one sub list (ProductCostHistories).
First here is the Product class, which is a separate class from the Linq generated Product class:
Here is the ProductModel class which does the interaction with Linq: