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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:16:27+00:00 2026-06-13T14:16:27+00:00

I have 3 Entities (MasterDoc, Folder, User) that i link together in another Entity

  • 0

I have 3 Entities (MasterDoc, Folder, User) that i link together in another Entity (Folder_User).

public class Folder_User
{
    public int Id { get; set; }
    public MasterDoc MasterDoc { get; set; }
    public User User { get; set; }
    public Folder Folder { get; set; }
}

After ive inserted an object of type Folder_User into the database, i can (on the same DbContext) query it and retreive the child objects.

public static List<Folder_User> GetAllFolder_USer(User user, DataModel dbContext)
    {
        List<Folder_User> list = null;

        var query = from f in dbContext.Folder_User
                     where f.User.Id == user.Id
                     select f;

        list = new List<Folder_User>(query);
        return list;
    }

But after a page-refresh (new dbcontext) when i run the same query the objects reference to MasterDoc is null.

*I have tried turn of lazy loading but nothing seems to fix it.
*Have also checked the database and the table is correctly containing a row with a MasterDoc Id.

  • 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-13T14:16:28+00:00Added an answer on June 13, 2026 at 2:16 pm

    You need to Include the MasterDoc in the query:

    public static List<Folder_User> GetAllFolder_USer(User user, DataModel dbContext)
    {
        var query = dbContext.Folder_User.
                              Include(f => f.MasterDoc).
                              Where(f => f.User.Id == user.Id);
    
        return query.ToList();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two entities: Recipe and Ingredient. Entites: public class Ingredient { public int
If I have entities like: @Entity public class Person { public String name; @OneToMany
I am using Entity Framework and DevExpress 10.5 XtraGrid. Imagine that we have entities
I have two entities A and B. public class A{ @Id @GeneratedValue private Integer
hey guys, say I have Entities and mappings like this: public class Episode {
I have entities Group and User . the Group entity has Users property which
I have entities: public class Document : PersistentObjectBase { public virtual long? FolderId {
If I have entities that inherit from a base entity (say Widgets, Gadgets, and
I'm working on a web application. I have entities that are supposed to be
I have two entities Visita and Cliente that implements respectively two interfaces IVisita and

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.