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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:39:18+00:00 2026-05-14T01:39:18+00:00

UPDATE : from what I’m hearing, I was imagining the problem I describe below.

  • 0

UPDATE: from what I’m hearing, I was imagining the problem I describe below. So, this is pretty much a non-question. Future readers, move on… nothing to see here.


I have an ASP.NET MVC project, much like the NerdDinner tutorial example. (I’m using MVC 2, but followed the NerdDinner tutorial in order to create it).

As per the instructions in part 3 of the tutorial, I’ve created a Linq-to-SQL model of my database by creating a “Linq to SQL Classes” (.dbml) surface, and dropping my database tables onto it. The designer has automatically added relationships between the generated classes based on my database tables.

Let’s say that my classes are as per the NerdDinner example, so I have Dinner and RSVP tables, where each Dinner record is associated with many RSVP records – hence in the generated classes, the Dinner object has a RSVPs property which is a list of RSVP objects.

My problem is this: it appears (and I’d be gladly proved wrong on this) that as soon as I
access a Dinner object, it’s loading all of the corresponding RSVP objects, even if I don’t use the RSVPs member.

First question: is this really the default behavior for the generated classes?

In my particular situation, the object graph contains many more tables (which have an order of magnitude more records), and so this is disastrous behaviour – I’d be loading tons of data when all I want to do is show the details of a single parent record.

Second question: are there any properties exposed through the designer UI that would let me modify this behavior? (I can’t find any).

Third question: I’ve seen a description of how to control the loading of related records in a DataContext by using a DataShape object associated with the DataContext. Is that what I’m meant to do, and if so are there any tutorials like the NerdDinner one that would show not only how to do it, but also suggest a ‘pattern’ for normal use?

  • 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-14T01:39:19+00:00Added an answer on May 14, 2026 at 1:39 am

    When you have a 1:M relationship, the L2S code generator will generate an entity class for the single entity and include an entity set of child objects within the entity. When you retrieve the single (parent) entity, L2S will not retrieve the child objects until you attempt to access the collection of child objects in some way. This is called Lazy Loading. There is no way, that I am aware of, to prevent L2S from retrieving the child objects, other than never attempting to access the collection of child objects. But note, if you never access the child collection, L2S WILL NOT retrieve the child rows. So, since your application is retrieving the child rows, you must be accessing the collection in some way.

    You can also perform what is called ‘eager loading’ by having L2S automatically retrieve the child objects before you attempt to access the collection. However, it doesn’t sound like this is what you want to do.

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

Sidebar

Ask A Question

Stats

  • Questions 545k
  • Answers 545k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • added an answer Well, start off by thinking of which bits of data… May 17, 2026 at 9:17 am
  • added an answer For this task it is a good idea to use… May 17, 2026 at 9:15 am
  • added an answer This is exactly how the Skyhook database (built into many… May 17, 2026 at 9:15 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Update for future readers: When .NET 4 comes out, LazyInit<T> from the CTP will
I have a simple NAnt build file, which attempts to perform an update from
I am trying to use jQuery's ajax functionality to update data from a web
How to detect IIS version using C#? Update: I meant from a winapp (actually
UPDATE : I discovered that I was calling the permalink from another table, with
How do I update a Gridview on a aspx page from a webmethod? Here
Is it possible to update IIS on Windows XP from 5.1 to 6? If
I'm looking to update our project's jaxb version from 1 to 2. Has anyone
Normally when you update an object in linq2sql you get the object from a
A puzzler from a coworker that I cannot figure out... update btd.dbo.tblpayroll set empname

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.