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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:22:33+00:00 2026-06-17T08:22:33+00:00

I have 3 entities, users, tasks and permissions. Users can have many permissions. Tasks

  • 0

I have 3 entities, users, tasks and permissions. Users can have many permissions. Tasks also have many permission associated with them. The idea that I am trying to capture in my query is this: My tasks need to be done by users with all the correct permissions required by the task.

I am struggling with the query. I think this is what I need:

var userList = context.Users
                      .Include("Permissions")
                      .Where(x => neededPermissionFromTask.Except(x.Permissions).Count() == 0).ToList();

But I get an exception:

Unable to create a constant value of type ‘Permission’. Only primitive
types (‘such as Int32, String, and Guid’) are supported in this
context.

Appreciate any help, suggestions or comments.

  • 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-06-17T08:22:34+00:00Added an answer on June 17, 2026 at 8:22 am

    Instead of passing list of Permission objects, pass ids of those permissions:

    var ids = neededPermissionFromTask.Select(p => p.Id).ToList();
    var userList = 
         context.Users.Include("Permissions")
                .Where(u => ids.Except(u.Permissions.Select(p => p.Id)).Count() == 0)
                .ToList();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an admin form that lets users create entities that require an image.
I have a GWT (+GAE) webapp that allows users to edit Customer entities. When
i have users and entities (many-to-many) , and using sqlalchemy, with this model: from
I have two entities that represent users ( User ) and friendship requests (
I have got two kind of entities, comments and tasks. Both types can be
Let's say i have two Doctrine entities: Users and Messages Every user can have
I have two entities, Users and Books with a has_and_belongs_to_many relationship. How can I
I have three entities: Session, User and Test. A session has 0-many users and
I have several entities which respresent different types of users who need to be
I have 2 entities: User and Avatar . Each user can choice one avatar

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.