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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:05:07+00:00 2026-05-23T17:05:07+00:00

We need to accept a collection of key values from user input. Then a

  • 0

We need to accept a collection of key values from user input. Then a query must be performed on a L2E data store which shall select all rows whose keys are included in the collection. The best I’ve got so far is:

var lines = dataStore.Entities.ToList(); /* To List to force a query */
var selectedLines = lines.Where(line=> inputValues.Contains(line.key)).Distinct();

However, this seems seems wasteful since we’re pulling the entire data store in order to select (probably) just a small number of rows. Would it be less wasteful to execute a separate query matching each key value (the column is indexed) or is there a better way with Linq syntax that I’ve missed?

  • 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-23T17:05:08+00:00Added an answer on May 23, 2026 at 5:05 pm

    EF4 has support for contains so you can just use it directly.

    var selectedLines = dataStore.Entities
                                 .Where(line=> inputValues.Contains(line.key))
                                 .Distinct();
    

    For possible workarounds in earlier versions see this SO question.

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

Sidebar

Related Questions

I need to accept form data to a WCF-based service. Here's the interface: [OperationContract]
I need to develop a template-like user control, which would accept any arbitrary content,
I need to get json data and I'm using urllib2: request = urllib2.Request(url) request.add_header('Accept-Encoding',
I need a regular expression pattern to only accept positive whole numbers. It can
Need to locate the following pattern: The letter I followed by a space then
I'm looking for a collection just like Dictionary(OF Key, Value) but I don't actually
i have a input tag which is non editable, but some times i need
I need to create a custom Contains LINQ expression that derives from System.Linq.Expressions.Expression that
I need to build a server to accept client connection with a very high
I need to connect to an sftp server from Mac OS X and the

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.