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 9250007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:20:32+00:00 2026-06-18T10:20:32+00:00

Initially I had a LINQ query (say EF or any other) with expected deffered

  • 0

Initially I had a LINQ query (say EF or any other) with expected deffered execution:

class Provider : IProvider
{
    public IEnumerable<Any> GetSome()
    {
         yield return new Any(); // LINQ query
    }
}

But now such a provider moved into a WCF service (and IoC):

unityContainer.RegisterType<IProvider>(
    new PerResolveLifetimeManager(),
    new InjectionFactory(c => new ChannelFactory<T>("IService").CreateChannel()));

Is it possible to preserve deferred execution over WCF call?

  • 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-06-18T10:20:33+00:00Added an answer on June 18, 2026 at 10:20 am

    This is answer is actually an answer to your last comment to Ladislav Mrnka. You say:

    Okay, I see, so there are no “free donuts” possible. In LINQ to Any we have such behavior but a necessity to cross the service boundaries, i.e. data to be (de)serialized, breaks it, right?

    While it doesn’t come for free, it is still possible!

    On the server side, you would have to provide a method to initialize the request and a method to get the results, one by one.

    On the client side – specifically on one of its low level infrastructure classes – you can wrap it in an enumerator and finally, your “business” classes can use that enumerator just like any other.

    We already discussed that it will introduce additional overhead in the means of the request-response needed for each item. This will introduce latency and increase the network load.

    A sample of this approach using a pseudo RESTful API could look like this:

    Server side:

    • POST http://server/api/search-specification:
      The body contains the parameters needed for your search, e.g. start date and end date
      The response will be an URI identifying the search-specification.
    • GET http://server/api/search-specification/1/next-result:
      The response will be the next item.

    The controller for this looks something like this:

    public Response PostSearchSpecification(SearchSpecification spec)
    {
        int id = _searches.Max(x => x.Key) + 1; // Make thread-safe
        _searches[id] = _provider.GetSome().GetEnumerator();
        return ...;
    }
    
    public Item GetNextResult(int searchSpecId)
    {
        if(_searches[searchSpecId].MoveNext())
            return _searches.Current;
        else
            return null; // or return a HTTP status code that tells the
                         // client that there are no more items.
    }
    

    I am calling it a pseudo RESTful API, because it certainly looks like one, but it needs to internally keep state for each specification to enable the deferred execution. Additionally GET http://server/api/search-specification/1/next-result is not idempotent.
    But I think it demonstrates what I mean 🙂

    The client side would encapsulate it somehow like this:

    class Search
    {
        public IEnumerable<Item> Start(params)
        {
            var client = new HttpClient(...);
            var resultsUri = client.Post(new SearchSpecification(params)).Response;
            Item item = client.Get<Item>(resultsUri);
            while(item != null)
            {
                yield return item;
                item = client.Get<Item>(resultsUri);
            }
        }
    }
    

    And you would use it like this:

    var search = new Search();
    
    foreach(var item in search.Start(...))
        // ...
    

    Just a raw sketch on how you could implement something like this.

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

Sidebar

Related Questions

When Defining a constructor in a class I initially had something like: public function
Initially I had written this query using LINQ-to-SQL var result = from w in
For this assignment I had to create my own string class. I initially wrote
Initially I had the following: [Flags] public enum QueryFlag { None = 0x00, CustomerID
Initially I had the following: [Flags] public enum QueryFlag { None = 0x00, CustomerID
Lets say I have a generic list of the the following objects: public class
I have multiple wars deployed in jetty. Initially I had a singleton class but
I have a UIViewController class MyClass that initially had no XIB, and was initialized
I initially had the following code: Boolean successCheckPoint = false; Boolean failureCheckPoint = false;
I've initially had two branches: master A---B---C \ fork D---E---F---H---I So I wanted to

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.