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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:36:04+00:00 2026-06-09T18:36:04+00:00

I have a normalised database that I’m using with EF4.3. In this instance, I

  • 0

I have a normalised database that I’m using with EF4.3.

In this instance, I have a User (everyone is a user). Some are Subscribers and Subscribers are either Contributors, Members or Administrators.

So for each type of User, I include the appropriate associations via navigation properties.

So a Member linq statement would be something like this:

            var u = r.FindBy(x => x.UserId == userId)
                .Include("Subscribers")
                .Include("Members")
                .SingleOrDefault();

In terms of an object everyone is a User – just different permutations.

I’m trying to fing the best way of handling this in code when some of the navigation properties aren’t included. For instance, I wouldn’t include Contributor or Administrator in the example above. Normally I could check for user.subscriber.contributor not being NULL, but instead I get the “object context has been disposed of…” even when I make this check.

How do I work around this?

  • 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-09T18:36:05+00:00Added an answer on June 9, 2026 at 6:36 pm

    You are receiving exception because your entities are proxied for lazy loading and they were not correctly detached before you disposed the context. Detaching entities with loaded relations is not directly possible (you must create a deep copy through serizliazation instead) so the best solution in this case is turning lazy loading off. In such case your entity will not try to lazy load navigation properties which are accessed for the first time.

    objectContext.ContextOptions.LazyLoadingEnabled = false;
    

    You can also turn off whole proxy creation instead:

    objectContext.ContextOptions.ProxyCreationEnabled = false;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a fairly standard OLTP normalised database and I have realised that I
I am using MySql Database, I have a task that is, Any item should
I have some XML code that looks like this <SEARCHRESULTS> <FUNCTION name=BarGraph> <PARAMETER name=numList></PARAMETER>
I'm trying to normalize a mysql database.... I currently have a table that contains
I have a range of tables that I have normalized for a user profile
I have received requirements that ask to normalize text box content when the user
I have a normalized database that stores locations of files on the internet. A
i have a database that already has a users table COLUMNS: userID - int
I have a quick question regarding a database that I am designing and making
I am reading some values from a database that is horribly un-normalized (which I

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.