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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:52:09+00:00 2026-05-24T05:52:09+00:00

hello, can you help me how to write Linq query (using Entity Framework) for

  • 0

hello, can you help me how to write Linq query (using Entity Framework) for the following requirements:

I have tables:

User(ID, Name),
Checklist(ID, Name, UserID(NOT NULL))
Job(ID, Name, UserID(NOT NULL))
Task(ID, Name, JobID(NULLABLE), UserID(NULLABLE), ChecklistID(NULLABLE)),

In the Task table there is always only one of foreign keys filled (others are NULL):

Task data example:

ID Name JobID UserID ChecklistID
1 T1 1 NULL NULL
2 T2 NULL 1 NULL
3 T3 NULL NULL 1
…

I want to select all tasks for the user based on the following rules:
1. all tasks belonging to user (UserID is filled)
2. all tasks which are related to job (JobID is filled) and Job is owned by the user
3. all tasks which are related to Checklist (ChecklistID is filled) and Checklist is owned by the user
4. ID of the user is input parameter

I want to get result in one Linq query. I’m beginner in Linq and I have no idea how to do it correctly.

thanks a lot for your help.

  • 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-24T05:52:10+00:00Added an answer on May 24, 2026 at 5:52 am

    This appears to be what you’re trying to get. You may have to add in “DataContext.” before the table names.

    var stuff = (from t in ScheduledTasks
                where t.UserID == userID            
                    || t.CheckLists.UserID == userID
                    || t.Jobs.UserID == userID
                select t);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I hope someone can help me. I need to know how to write
Hello I need to have multiple language support of my django admin application.I can
Can this method work? public String sayHello(){ return Hello.jsp?name= + laala; } I am
Hello i have somme problems to write a simple XML-RPC client in PHP. This
hello everyone I'm trying to write function which can unfold int in the list
Hello all I hope someone can help me resolve this issue.. I'm curious as
I was developing an application using Entity Framework and storing data in a .mdf
Hello StackOverflow Community, I hope you guys can help me with this here: On
Hello can somebody write or point to a good symfony plugin installation tutorial. Here
Hello can anybody solve this please I'm creating the object in the action class

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.