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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:02:57+00:00 2026-05-14T22:02:57+00:00

Stepping away more and more from writing SQL for my applications, I decided to

  • 0

Stepping away more and more from writing SQL for my applications, I decided to give the Entity Framework a try. However, I’ve run into something I believe is causing me to write more code than I think is strictly necessary.

When I accessed some navigational properties, I discovered that all many-to-one relations (simple references) were null and all one-to-many and many-to-many relations (EntityCollections) were empty.

For example: I have a User with a reference to a Group. When I have retieved a User, by using a simple select-by-id, the Group property is null. If I want to access the Group I have to manually load it (using User.GroupReference.Load()). So I added a GetGroup() method in User which checks whether the Group is loaded already and, if not, does so and then returns the Group.

Now this will result in a lot of highly similar methods for all navigational properties. And it all results in the navigational properties not being used, only my custom-made Get”PropertyName”() method’s are now being used.

I don’t want to expand my queries (linq to entities) to immediately load all these properties, because it’s not always known at first what is needed. And besides, it would cause a lot of queries to have to be made.

Is there a way to configure the Entity Framework to load these objects when they happen to not be present? So when I access User.Group and the group is not loaded yet, it is loaded automatically? Or am I stuck using my own Get”PropertyName”() method’s as long as I’m trying to load objects only on demand (or “just-in-time”)?

Some extra info: I’m using VS2008 SP1 with .NET 3.5 SP1. The Entity Framework I’m using is the one that got shipped with it.

  • 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-14T22:02:57+00:00Added an answer on May 14, 2026 at 10:02 pm

    You can get EFLazyLoading – this will add transparent lazy loading support to the Entity Framework by replacing the code generator.

    There is no build-in support for transparent lazy loading in the Entity Framework 1.0 – only eager loading using Include() and manual lazy loading using Load(). I am not sure about the Entity Framework 2.0 but if there is no build-in support it should at least be easier to add than before because of the use of T4 for code generation.

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

Sidebar

Related Questions

When stepping a program in Delphi 7, the CPU window sometimes pops up and
You're stepping through C/C++ code and have just called a Win32 API that has
Using C# in Visual Studio 2008 and stepping through a function in the debugger
Python 2.6 was basically a stepping stone to make converting to Python 3 easier.
Is there an attribute I can use on a method so that when stepping
I am starting a job with a mid size company working mostly on writing
My automated script for starting and stopping VMWare Server virtual machines has stopped working.
I have a problem with stopping a service and starting it again and want
I'm having an amazing amount of trouble starting and stopping a service on my
I would like to update a dll for a server process without stopping the

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.