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

  • Home
  • SEARCH
  • 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 8122481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T05:50:58+00:00 2026-06-06T05:50:58+00:00

I have a situation where I will be using a repository pattern and pulling

  • 0

I have a situation where I will be using a repository pattern and pulling objects from the database with a lazy loaded GetAll method that returns IQueryable. However I also need to build dynamic objects that will be included with the lazy loaded objects(query).

Is it possible to add built objects to a lazy loaded IQueryable and still keep the lazy loaded benefits? For instance

public override IQueryable<Foo> GetAll()
{
    return _entities; // lazy loaded
}  

public override IQueryable<Foo> GetAllPlusDynamic()
{
    var entities = GetAll(); 
    foreach(var d in GetAllDynamic())
    {
        entities.Add(d); // eagerly loaded
    }
    return entities;
}
  • 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-06T05:51:01+00:00Added an answer on June 6, 2026 at 5:51 am

    I am unsure if I understand you correctly but refering to your comment…

    Yes, basically query the database for a set of objects and then query
    another data source (in this case a service) and build a set of
    objects.

    … I would say that it’s not possible.

    An object of type IQueryable<T> used with Entity Framework (LINQ to Entities) is basically a description of a query which the underlying data store can execute, usually an abstract description (expression tree) which gets translated into SQL.

    Every part of such a query description – where expressions, select expression, Any(...) expressions, etc. – must be translatable into the native language (SQL) of the data store. It’s especially not possible to include some method calls – like a service call – in an expression that the database cannot understand and perform.

    IQueryable<T> knows an underlying “provider”. This provider is responsible to translate the expression tree hold by the IQueryable<T> object into “something”, for example T-SQL used by SQL Server, or the SQL dialects used by MySQL or Oracle. I believe it’s possible to write your own provider which might then be able to perform somehow the service calls and the database queries. But I also believe that this is not an easy task.

    Using the standard SQL providers for Entity Framework you have to perform database query and calling the service separately one after each other: Run query and materialize entities in memory – then run the service call on the result collection for each entity.

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

Sidebar

Related Questions

I have a unique situation where I'm building a site that will call data
I have situation in which I read a record from a database. And if
I have a situation about in using ListView and found that if I set
I have a test environment for a service that my site will be using
I have a challenging situation; we will have programs on Mac, PC, iOS and
Following situation: I have a JFrame and call JOptionPane.showInputDialog(test) . The modal dialog will
I have situation, where running a query that filters by an indexed column in
Using c#, .net, Visual Studio 2010 I have a situation when a user clicks
I have a situation where I am making ajax requests to a server from
We have a situation where two web applications are working on the same database.

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.