GridView, VirtualQueryableCollectionView, and WCF Service (not RIA)

4 posts, 1 answers
  1. Eugeniy
    Eugeniy avatar
    60 posts
    Member since:
    Feb 2011

    Posted 22 May 2011 Link to this post

    Is any way to translate GridView filtering and sorting e t.c. options to the WCF Service so Service Method could do the things in LINQtoSQL datacontext? I just want to call Wcf Services in RIA manner

    For example, at SilverLight Client Control we call the service method:

    //SilverLight Client Control with DataGrid:
    public class MyControl : UserControl
    {
    ...
    private IEnumerable<Employee> Search(GridViewOptions options)
    {
       var asyncResult = myService.BeginGetEmployees(options);
       return myService.EndGetEmployees(asyncResult);
    }
    ...
    }

    And at the Wcf Service:
    [OperationContract]
    public Employee[] GetEmployees(GridViewOptions options)
        using(var db = new DB()) //DB is the LinqToSql DataContext
        {
            return db.Employees
               .ApplyGridOptions(options)  //this is the thing i want
               .BeforeSending()   //it's my own method, which caches some related data, and fills custom fields in partial class Employee
               .ToArray();
        }
    }
    I found the class VirtualQueryableCollectionView. Could it help me?

    I do not want to use RIA services because:
    1) I want to call service synchronously in my customized SilverLight thread like this:
    DoWork("Loading Genres...",(sender, args) =>
                                   {
                                    args.Result = Communication.Proxy.GetGenres();
                                   },(o, eventArgs) =>
                                             {
                                                  if(eventArgs.Error==null)
                                                  {
                                                     genreGrid.ItemsSource = eventArgs.Result;
                                                  }
                                             });

    (i'm using my own tool, which generates wcf sync proxies)
    2) The code is more clear.
    3)I want to load and store some advanced data in the entities
  2. Answer
    Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 25 May 2011 Link to this post

    Hello,

     I've attached small example project to illustrate you how to achieve your goal with VirtualQueryableCollectionView and plain WCF/Web service. The server-side code of the project is exactly the same as the project in this blog post. 

    Regards,
    Vlad
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Eugeniy
    Eugeniy avatar
    60 posts
    Member since:
    Feb 2011

    Posted 25 May 2011 Link to this post

    Great.
    But why grouping is not working?
  5. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 25 May 2011 Link to this post

    Hello,

     Grouping is not supported currently with VirtualQueryableCollectionView. I've forgot to provide link to the blog post in my previous reply - here is it:
    http://blogs.telerik.com/vladimirenchev/posts/10-01-14/how_to_server_sorting_filtering_grouping_and_paging_with_radgridview_for_silverlight_without_wcf_ria_services.aspx

    Regards,
    Vlad
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top