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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:16:05+00:00 2026-05-25T22:16:05+00:00

I can’t post a full working example right now, but I was hoping someone

  • 0

I can’t post a full working example right now, but I was hoping someone would have an idea of what might be going on here. (I’ll try to toss together a small working sample later this evening if no one can explain what might be happening from what’s posted)

List<CVENT.Idea> ideas = ideaDAL.GetList(filter);

foreach (CVENT.Idea idea in ideas)  // Setup foreign key mapping
    BuildRelationships(idea, 8);

// Breakpoint set on next line.
ideas = (from   idea in ideaDAL.GetList(filter)
        where   IdeaSatisfiesCriteria(idea,filter)
        select  idea).ToList();
// I then Run To Cursor to This Line so I get a before and after the previous line.
foreach (CVENT.Idea idea in ideas)  // Setup foreign key mapping
    BuildRelationships(idea, 8);

return  ideas;

So I am loading some ideas from our DAL layer. This works fine. I then have a “BuildRelationships” function that assigns some Lambda expressions to Func delegate variables for each idea.

In Build Relationships function

private CVENT.Idea BuildRelationships(CVENT.Idea idea, int userID)
{
    idea.MapComments = thisIdea => commentBLL   .GetList(thisIdea.IdeaID, userID).ToList();
    return idea;
}

In my idea entity

public Func<Idea, List<Comment>> MapComments { get; set; }

This is a read only implementation of a Foreign Key Mapping Pattern where I am injecting the initialization for the foreign keys into my entity so that it can lazy load the foreign entity on demand.

The problem is that after the line I have the first breakpoint set on all of the Mapping variables are cleared to null (hence the second call to remap the relationships). I am guessing it has something with the creation of a new list because of ToList(), but what I don’t understand is why the Mapping delegate variables aren’t getting carried over with the rest of the properties. Any ideas?

(IdeaSatisfiesCriteria only does comparisons nothing is getting changed within the function.)

  • 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-25T22:16:06+00:00Added an answer on May 25, 2026 at 10:16 pm
    ideas = (from   idea in ideaDAL.GetList(filter)
            where   IdeaSatisfiesCriteria(idea,filter)
            select  idea).ToList();
    

    All the mappings disappear because you are re-querying your ideas from the DAL instead of taking the existing list to which you applied the mappings. You probably intended to do this:

    ideas = (from   idea in ideas 
            where   IdeaSatisfiesCriteria(idea,filter)
            select  idea).ToList();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
Can someone explain dependency injection with a basic .NET example and provide a few
Can anyone give me an example of how to return the following json simply
Can someone guide me on a possible solution? I don't want to use /bin/cp
can someone explain why the compiler accepts only this code template<typename L, size_t offset,
Can't figure out how to do this in a pretty way : I have
Can you have submenus with the top level set to checkable in WPF? I
can someone show me the regex for this preg_match. I want to make sure
Can someone tell me the regex to see if something is surrounded in double
Can someone help me? I am trying to do something like the following: #include

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.