Tuesday, May 3, 2011

WCF Sorting and filtring

Im doing a proof of concept on wcf and mvc. And I got some questions:

Is there already a built-in solution for handling sorting/filtring in WCF? Or do i have to do somthing like this, optional sorting class:

[OperationContract]
Invoice GetInvoices(SortingClass criteria);

Is there a build-in solution for lazyloading in WCF, or use lazyloading patterns?

I wanna do all sorting/filtring on the serverside to have more control and unit test friendly enviroment.

From stackoverflow
  • Sorting and filtering and WCF have nothing to do with eachother. WCF is about communication between processes. What you communicate about isn't interesting from the WCF point of view.

    So you have to implement sorting and filtering yourself (as in most cases). There is nothing wrong with providing a parameter that specifies your sorting criteria.

    As for lazy loading, I suppose you would want to do something like this?

    • get object a from web service and load all primitive properties
    • on the client call a.ListOfObjects
    • ListOfObjects for instance a is automagically loaded from the web service

    This is also something you have to do yourself. You could take a look at ADO.NET Data Services for this. No lazy-loading but a similar pattern.

    larole : thanks for the fast reply. Guess the same goes for lazy loading?
    larole : thanks again, very helpful

0 comments:

Post a Comment