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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:53:58+00:00 2026-06-04T11:53:58+00:00

I have got entity: Entry { public virtual ICollection<Content> Contents { get; set; }

  • 0

I have got entity:

Entry
{
    public virtual ICollection<Content> Contents { get; set; }
}

I need to get the Entry that contains filtered Contents.

var entryWithFilteredContents = dbContext.Entry.Single(). ???
    /*Load(entry=>entry.Contents) Where(content=> content.Value > 10)*/

Now when I write entryWithFilteredContents.Contents I expect to receive only contents that have Value greater then 10. I know i can get an var entry = db.Context.Entry.Single() and then var contents = entry.Contents.Where(content=> content.Value > 10) but that don’t satisfy my needs.

  • 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-04T11:54:00+00:00Added an answer on June 4, 2026 at 11:54 am

    This is not something EF currently supports out of the box.

    The usual workaround is to first select a projection, like this:

    var query = from e in dbContext.Entry
                select new { Entry = e, Related = e.Contents.Where(c => c.Value > 10) };
    return query.Where(p => p.Related.Count > 0).Select(p => p.Entry);
    

    You can of course also return any projection directly (and potentially save some database round-trips), but will need a non-anonymous type in order to have the result escape the current method.

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

Sidebar

Related Questions

I have got an Entity model which contains a collection of Message objects which
I have got a server that controls a complicated industrial system. We need to
I am using the Entity Framework and have got a loop that looks at
I got a application where I use DateTime.MaxValue to indicate that a entry have
I have got a onetomany relation in Hibernate: @Entity public class Project @OneToMany(cascade =
I have got some code to load an assembly and get all types, which
I've got a window set up with two NSTableViews. In Core Data I have
I am working with MVC3 and entity framework I have got a table with:
I have got choice for using either Entity SQL query inside my DAL or
I have the following problem: I've got an entity class 'TEntity' and a mesh

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.