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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:11:17+00:00 2026-06-16T05:11:17+00:00

I have come across a strange scenario using the entity framework in the Where

  • 0

I have come across a strange scenario using the entity framework in the “Where” where by I can search for a string but not a string the is part of an array:

This works:

string line = sr.ReadLine();
string[] row = line.Split(';');
string code = row[0];
TableObject to = db.TableObject.Where(e => e.property == code).FirstOrDefault();

However If I try and simplify the code by omitting the step string code = row[0] and doing the following:

string line = sr.ReadLine();
string[] row = line.Split(';');
TableObject to = db.TableObject.Where(e => e.property == (string) row[0]).FirstOrDefault();

I get the following exception:

System.NotSupportedException: The LINQ expression node type 'ArrayIndex' is not supported in LINQ to Entities.

I find it strage that the excepption is complaining about an Array seeing as I have specificaly cast the row[0] array as a (string).

.ToString() does not solve the problem either.

I know this is no big deal but I am curious as to why this is.

  • 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-16T05:11:19+00:00Added an answer on June 16, 2026 at 5:11 am

    Entity Framework tries to translate the complete expression e => e.property == (string) row[0] into a SQL WHERE statement. It just doesn’t know what SQL expression to translate (string) row[0] into.

    Every LINQ provider can only handle a set of specific instructions. The EF LINQ provider doesn’t support evaluating an array’s index. It can only use primitives. That’s why you have to extract the string from the array outside the lambda.

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

Sidebar

Related Questions

I have come across a strange problem with Zend_Framework, I can not load forms
I have come accross a strange problem that can be illustrated using the 2
I have come across a very strange issue in python. (Using python 2.4.x) In
I've come across a very strange issue that I have a workaround for, but
I have come across a strange behavior while executing a SELECT query using Statement#executeUpdate()
I have come across a strange defect. I am using Orbeon 3.9 CE on
During my university exercise I have come across strange behaviour of a variable. /*
I have come across a strange problem which I would like to get your
I have come across some strange behaviour, and I'm assuming a bug in Firefox,
I have come across a strange error. I have an Android project that uses

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.