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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:47:51+00:00 2026-05-26T13:47:51+00:00

Ive been having some problems regarding circular references when converting EF entities to json

  • 0

Ive been having some problems regarding circular references when converting EF entities to json objects. I have found a solution that works for me, but i would like to know what is actually happening when im adding

 context.ContextOptions.ProxyCreationEnabled = false;

and/or

context.ContextOptions.LazyLoadingEnabled = false;

The first one seems to be enough to get a single-dimensional json object. Should i use both? And what does they actually do? Is there a smarter way around this? 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-26T13:47:52+00:00Added an answer on May 26, 2026 at 1:47 pm

    First line turns off runtime generation of class that inherits from your entity class. This class is really used during runtime. Not your class. This runtime generated class is probably not Serializable and that’s why this line (turning off proxy generation) makes serialization work.

    Second line turns off lazy loading. So let’s say you have Parent entity and Child entity. When you ask for Parent you don’t load Children when lazy loading is on. When it is off whenever you load Parent you load all of it’s children. I think this is something you should familiarize with if you are using EF.

    Edit:
    If there is problem with circular reference then you should turn off lazy loading. Then when you serialize Parent you will not try to serialize Children that have reference to Parent (creating circular reference)

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

Sidebar

Related Questions

I've been having some problems with using BerkeleyDB. I have multiple instances of the
I have been having some problems with the test debugger in VS10. All tests
I'm having some problems with converting some JSON and I'm after some help. This
Ive been having some problems with understanding the MySql reader from MySql.Data.MySqlClient This is
I've been having a crack at some of the problems over at http://projecteuler.net/ with
I am having some problems with hibernate and MySQL. I've been reading but I
I've been having some problems with ActionMessages created during execution of an action which
Ive been having some trouble using Plot to graph a complicated composite function. I
I've been having some problems with NSDate and saving it in NSUserDefaults. It seams
I've been having some problems with a few Fan Pages and getting their details

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.