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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:28:54+00:00 2026-05-16T00:28:54+00:00

How to expand this query: public Dictionary<int, List<TasksInDeal>> FindAllCreatedTasks() { return (from taskInDeal in

  • 0

How to expand this query:

public Dictionary<int, List<TasksInDeal>> FindAllCreatedTasks()
{
    return (from taskInDeal in db.TasksInDeals
            where taskInDeal.Date > DateTime.Now && taskInDeal.Date < DateTime.Now.AddDays(7)
            group taskInDeal by taskInDeal.CreatedByUserID
                into groupedDemoClasses
                select groupedDemoClasses).ToDictionary(gdc => gdc.Key, gdc => gdc.ToList());
}

into something like this:

public Dictionary<int, List<TaskForNotification>> FindAllCreatedTasks()
{
    return (from taskInDeal in db.TasksInDeals
            join user in db.Users on taskInDeal.CreatedByUserID equals user.UserID
            where taskInDeal.Date > DateTime.Now && taskInDeal.Date < DateTime.Now.AddDays(7)
            group taskInDeal by taskInDeal.CreatedByUserID
                into groupedDemoClasses
                select new TaskForNotification 
                { 
                    Email = user.Email,
                    TaskInDealField1 = taskInDeal.TaskInDealField1,
                    TaskInDealField2 = taskInDeal.TaskInDealField2,
                    TaskInDealField3 = taskInDeal.TaskInDealField3,
                    ...
                }
                ).ToDictionary(gdc => gdc.Key, gdc => gdc.ToList());
}

So, to first query I need to join email from other table.

  • 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-16T00:28:54+00:00Added an answer on May 16, 2026 at 12:28 am
      // do the date logic up front, not in the database.
    DateTime now = DateTime.Now
    DateTime weekFromNow = now.AddDays(7);
    
      // pull the joined rows out of the database.
    var rows =
    (
      from taskInDeal in db.TasksInDeals
      where taskInDeal.Date > now && taskInDeal.Date < weekFromNow
      join user in db.Users
        on taskInDeal.CreatedByUserID equals user.UserID
      select new {TaskInDeal = taskInDeal, UserEmail = user.Email}
    ).ToList();
    
      // shape the rows in memory
    Dictionary<int, List<TaskForNotification>> result =
    (
      from row in rows
      let taskForNotification = new TaskForNotification  
      {  
        Email = row.UserEmail, 
        TaskInDealField1 = row.TaskInDeal.TaskInDealField1, 
        TaskInDealField2 = row.TaskInDeal.TaskInDealField2, 
        TaskInDealField3 = row.TaskInDeal.TaskInDealField3, 
        ... 
      }
      group taskForNotification by row.TaskInDeal.CreatedByUserID
      // without an "into", group by ends the query.
    ).ToDictionary(g => g.Key, g => g.ToList()); 
    

    When you group, bear this in mind. Groups in SQL have only keys and aggregates. Groups in LINQ have keys, aggregates and elements! If you ask the database for groups, and then ask for the elements – SQL couldn’t provide you with those elements in a single query. You’ll wind up automatically repeatedly re-querying using the group’s key as a filter.

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

Sidebar

Related Questions

I'm asking this question purely from a usability standpoint ! Should a website expand/stretch
I have a query: SELECT * from arrc_Voucher WHERE VoucherNbr REGEXP ^1002 This works
This question will expand on: Best way to open a socket in Python When
Does anyone know if there's a way to automatically expand a list in Python,
I saw this Q&A MongoDB Norm query nested objects , but it seems to
I am using this query to print out a forum board and all it's
I have this code: $result = mysql_query(SELECT * FROM quote ORDER BY RAND() LIMIT
hey guys, i manage to get this script working to pull data from my
I want to know how this regular expression is expand and how it validates
Being relatively new to functional programming, I expend lots of energy wondering is this

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.