DataSource for Entity Framework in WPF > Live Views |
Client views are live; they are kept automatically up-to-date with changing data. But live views functionality is more general, live views (objects of class C1.LiveLinq.LiveViews.View|keyword=View(Of T) class from which ClientView is derived) can be defined on data of any kind, including but not limited to entities, and they support more LINQ query operators, such as grouping, sorting, joins and more (see LiveLinq).
All such operations (of which the most popular are grouping and sorting) can be applied to client views (because ClientView is derived from, For example:
LINQ |
Copy Code
|
---|---|
View productsByCategory = products .OrderBy(p => p.ProductName).GroupBy(p => p.CategoryID); or in LINQ query syntax: View productsByCategory = from p in products orderby p.ProductName group p by p.CategoryID into g select new { Category = g.Key, Products = g }; |
The resulting views are live, but they are not client views. This is not a defect of some sort; it is simply because such views don’t need ClientView|document=XMLDocuments\Reference;topic=ClientView(T) Class functionality. Sorting and grouping can be performed entirely on the client without resorting to the server. However, developers must be aware of this fact to avoid confusion. Once you applied a LINQ query operation to your view, it becomes a View, not a ClientView (however, it remains live, automatically reflects all changes you make to the data on the client). So, for example, if you need server-side filtering, use the AsFilter|keyword=AsFiltered method method, not the LINQ Where method. Use the LINQ Where method when you want filtering on the client.