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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:42:31+00:00 2026-05-26T07:42:31+00:00

IQueryable<Employee> emps = CreateObjectSet<Employee>() .Include(u => u.Departments) .AsQueryable(); IQueryable<Products> prods = CreateObjectSet<Products>().AsQueryable(); CreateObjectSet is

  • 0
IQueryable<Employee> emps = CreateObjectSet<Employee>()
                                  .Include(u => u.Departments)
                                  .AsQueryable();
IQueryable<Products> prods = CreateObjectSet<Products>().AsQueryable();

CreateObjectSet is ObjectContext’s CreateObjectSetMethod

        return (from emp in emps
                join prod in prods
                on emp.ProductID equals prod.ProductID
                where emp.EmployeeID == 10
                select employee).ToList();

The problem is from the first line, i use the include statement and include departments with the employees the return values does not have departments with as they are never included. Kindly suggest something.

This is just a demo query, actual query is far complex, so please don’t suggest that i should not go with the join statement, but simple include and where clause, that does not serve me ni my scenario.

Thanks

  • 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-26T07:42:32+00:00Added an answer on May 26, 2026 at 7:42 am

    This is a known issue with include. You could have a look at the following article Include in EF

    var results =
             ((from post in ctx.Posts
             from blog in post.Blogs
             where blog.Owner.EmailAddress == "alexj@microsoft.com"
             select post) as ObjectQuery<Post>).Include("Comments");
    

    If that solution won’t work for you, you can also try to fix it with grouping your data and selecting the departments as one of the values in your type.

    The EF entity relation fixup mechanism will then ‘fix’ the include for you.

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

Sidebar

Related Questions

public IQueryable<RecentlyCreatedAssetViewModel> getRecentlyCreatedAssetsByCompanyID(int companyID) { return (from a in db.Assets join ab in db.AssetBundles
I've a linq query over two Entities like this IQueryable<Employee> employees = CreateObjectSet<Employee>().AsQueryable(); IQueryable<Department>
IQueryable<T> IS3Repository.FindAllBuckets<T>() { IQueryable<object> list = _repository.GetAllBuckets().Cast<object>().AsQueryable(); return list == null ? default(T) :
public IQueryable<ArticleDisplay> SearchNumberOfArticles(int articleNr, string order) var result = ( from category in db.ArticleCategories
I thought IQueryable <T> was derrived from IEnumerable <T> , so why can't I
i return such type IQueryable< IGrouping<int, Invoice>> List() how can i work with it?
My IQueryable line is: // find all timesheets for this period - from db
I have an IQueryable object like this var persons = from m in db.Persons
I want to return the depart number that is not found Employee Table by
I am returning IQueryable<Customer> to the other method for some querying operations. The return

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.