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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:32:40+00:00 2026-06-10T08:32:40+00:00

Im having a littel problem with LINQ I have a EntityCollection of Resource Each

  • 0

Im having a littel problem with LINQ

I have a EntityCollection of “Resource” Each “Resource” have a EntityCollection of “Applications”

I now need to find the “Rresources” for a particular “Application”

I first find the given application:

Application application = (from app in db.ApplicationSet
                           where app.Id == appId
                           select app).First();

This gives me the “Application”

I then try to find the applications for this “Application”:

var res = from rs in db.ResourceSet
          where rs.Applications.Contains(application)
          select rs;

This is accepted in VS, but when i run it debug the “result view” returnes with a

“System.SystemException = {“Unable to create a constant value of type ‘Application_Configuration_Management.Models.Application’. Only primitive types (‘such as Int32, String, and Guid’) are supported in this context.”}”

Can anyone help me?

  • 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-10T08:32:41+00:00Added an answer on June 10, 2026 at 8:32 am

    Your LINQ2SQL or EF provider complains that it cannot translate a query that uses an application in a context of an IN list. Replacing a search for an application followed by a search for one of its resources with a single search for a resource by application ID may work better in your situation:

    var res = from rs in db.ResourceSet
        where rs.Applications.Any(a => a.Id == appId)
        select rs;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a little problem with nginx and the Perl FCGI module. I have
I'm having a little problem with Merging dictionaries in my WP7 application, The app
I am having a new little problem; I have a little pointer called: int
I'm having a trouble with this little problem. Let's say, I have an array,
Having a bit of a problem getting my LINQ query to return the object
I'm having a little problem with jQuery ajax and an animation. I have a
I'm having a little problem here! I have discovered the following as being the
I am using reflection along with linq.Dynamic, and I am having a small problem
I'm having a problem when passing nulls to a ExecuteCommand() method using linq. My
I am having little problem when compiling assets if i specify a my application

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.