Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6894853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:50:03+00:00 2026-05-27T06:50:03+00:00

Here’s an interesting problem that I hope someone can lend a hand with. I

  • 0

Here’s an interesting problem that I hope someone can lend a hand with.

I have a DomainService class with the following query:

    [Query]
    public IEnumerable<BatchResult> GetBatchResults(int batchId)
    {
        return ObjectContext.BatchQueries
            .Include("BatchTCResults")
            .Include("BatchANFResults")
            .Where(x => x.BatchId == batchId)
            .Where(x => x.BatchTCResults.Any() || x.BatchANFResults.Any())
            .ToArray() // enumerate because projection calls a method that EF will poop it's pants on
            .Select(x => new BatchResult
            {
                BatchQueryId = x.Id,
                Route = x.Routing,
                Account = x.Account,
                Amount = x.Amount,
                CheckNumber = x.CheckNumber,
                Severity = BatchResult.DetermineOverallSeverity(x)
            });
    }

This works BUT I really need the paging/sorting information passed from the Silverlight client to be applied before enumeration happens in the line calling .ToArray()

The client side is using the DomainDataSource Silverlight control.

How can I achieve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:50:04+00:00Added an answer on May 27, 2026 at 6:50 am

    The easiest way is adding paging/sorting/filtering parameters to the method arguments list and adding corresponding LINQ query operators to your data context query in the service method. However, in this case you’ll loose client-side IQueryable features. I mean, client’s queries will reach only the application server, but won’t get to the database. And you’ll need some layer between the DomainContext and the UI: DomainDataSource is not likely to work.

    Exposing the results of the query as IQueryable using AsQueryable() won’t help since expression trees will be unconditionally compiled into code in order to execute your LINQ-to-Objects operators.

    Somewhat harder option is using arguments as in first case together with writing your own IQueryable wrapper over the client-side query object. This wrapper would extract parameters from query expressions and pass them to the service as method arguments. Well, I’d only try this if I had enough spare time.

    Another difficult way is doing analogous thing server-side. It’s possible to get an IQueryable object that has the expression tree passed from client in a DomainService. You’ll need to override the DomainService.Query method. Then you’ll be able to extract part of the query expression that relates to paging/sorting, save it to a field and then apply to the database query. However, Query method is single for all methods in a given DomainService. Therefore, you’ll probably end with a big table method that decides what to do for each of the service query methods. Needless to say, the service will become very difficult.

    To conclude, I strongly recommend you the first option.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my problem...I have a page that loads a list of clients and
Here is the issue I am having: I have a large query that needs
Here is my problem : I have a post controller with the action create.
Here's a query that works fine: SELECT rowid as msg_rowid, a, b, c FROM
Here is my code (Say we have a single button on the page that
Here is another spoj problem that asks how to find the number of distinct
Here's a problem I ran into recently. I have attributes strings of the form
Here's my scenario - I have an SSIS job that depends on another prior
Here's a coding problem for those that like this kind of thing. Let's see
Here's an interesting problem. On a recently installed Server 2008 64bit I opened IE

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.