ComponentOne Data Source for Entity Framework
Programming Guide / Using ClientView in Code / Creating Client Views
In This Topic
    Creating Client Views
    In This Topic

    ClientView objects represent queries that can be executed on the server. In that regard, they provide the same functionality as queries of Entity Framework and RIA Services. When you start by creating the first ClientView in a newly created context, that's exactly what you get: an EF (or RIA) query that is executed on the server; the resulting entities are fetched to the client and made available for data binding and/or programmatic access on the client. When you continue working on the client, that is, modify some entities on the client and query for more entities, your client views start exhibiting richer behavior that you would not get from mere EF (or RIA) queries:

    The starting point for creating client views are the GetItems methods of EntityClientScope (RiaClientScope):

    ClientView<Product> products = _scope.GetItems<Product>();

    or, in RIA Services (Silverlight):

    ClientView<Product> products = _scope.GetItems<Product>("GetProducts");

    (in RIA Services you need to specify the name of a query method in your domain service).

    Having thus started with a base query, you can then apply filtering and paging to the view. Filtering and paging are operations that are performed on the server (if the data is not found in the cache), so applying them to a ClientView results in another ClientView. You can also apply other LINQ operators to a client view, such as grouping, sorting, and so on. That results in a View, which is the base class of ClientView. It is also a live view but it does not need ClientView functionality because those operators don't need the server; they can be performed entirely on the client.