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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:42:32+00:00 2026-06-01T17:42:32+00:00

I have this method I wrote as: private void GetReceivedInvoiceTasks(User user, List<Task> tasks) {

  • 0

I have this method I wrote as:

private void GetReceivedInvoiceTasks(User user, List<Task> tasks)
        {
            var taskList = from i in _db.Invoices
                           join a in user.Areas on i.AreaId equals a.AreaId
                           where i.Status == InvoiceStatuses.Received
                           select i;

        }

Basically I was trying to get all the Invoices in the database in the user’s area that have a status of received. I don’t understand LINQ too well right now.

I’m getting the error:

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

Can someone please explain to me what I’m doing wrong and how to remedy this? I can’t currently understand what the problem is. If I take the join line out it’s fine but I really need that line to make sure I only have invoices from the users area/areas (they can belong to more than one area). Have I got something fundamentally wrong with this query?

  • 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-01T17:42:33+00:00Added an answer on June 1, 2026 at 5:42 pm

    Entity framework does not support joins with in-memory collections. You will have to re-wire your query to make use of a Contains query with a collection of primitives instead.

    Also EF currently does not support enum values so you will have to compare with an integer value (If InvoiceStatuses.Received is not an enum value ignore this part).

    Both fixes combined lead to the following query approach which should result in results equivalent to your join:

    int statusReceived = (int)InvoiceStatuses.Received;
    var areaIds = user.Areas.Select(x=> x.AreaId).ToArray();
    
    var taskList = from i in _db.Invoices
                   where i.Status == statusReceived && areaIds.Contains(i.AreaId)
                   select i;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this method: private delegate void watcherReader(StreamReader sr); private void watchProc(StreamReader sr) {
I have this method to transfer files using a FTP Server: private void TransferNeededFiles(IEnumerable<string>
I have a C# .NET 3.5 Windows Form program with this method: private void
I have this method on a webpart: private IFilterData _filterData = null; [ConnectionConsumer(Filter Data
I have this method for grabbing the file name from a string URI. What
I have this method in my db class public function query($queryString) { if (!$this->_connected)
I have this method: public bool CanExecute() And after 70 commits, I added an
I have this method Verify_X which is called during databind for a listbox selected
I have this method that changes an larger image source on click. I need
I have this method call I have to use... financial_document.assets.length But financial_document.assets could be

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.