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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:12:09+00:00 2026-06-07T01:12:09+00:00

I am curious as to what the best practice is for performing queries that

  • 0

I am curious as to what the best practice is for performing queries that contain methods/functions not supported by Entity Framework with no SQL conversion.

For example:

DataContext db = new DataContext();
Administrator admin = db.Administrators.Where(admin => admin.Username.ToString() == "test");

Will not work as the method ToLower() has no supported SQL conversion.

Currently I do this:

DataContext db = new DataContext();
Administrator admin = db.Administrators.ToArray().Where(admin => admin.Username.ToString() == "test");

However I do not think converting the administrators set to an array to perform these kind of queries is very good performance wise.

Can someone please tell me what the best practice is for these kinds of queries in Entity Framework?

Thanks,
Alex.

  • 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-07T01:12:10+00:00Added an answer on June 7, 2026 at 1:12 am

    Two choices –

    • Write a stored procedure and import it
    • Push the results into memory using ToArray() and then you can use all the methods you want (not great performance unless the initial result set is small).

    The Entity Framework query provider has to know how to translate the method call into SQL and while you can develop your own, I don’t think you can subclass theirs – so adding your own methods to it won’t be easy. Or, to put it another way, bloody difficult!

    It’s probably horribly unpopular, but I’m still using a lot of SPs when I get to the real nitty-gritty of data querying. Although part of the motivation in my environment is whether other non-EF environments need to be able to reproduce similar behaviours.

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

Sidebar

Related Questions

I am curious what the best practice is for this situation in Entity Framework
I am curious what the best practice is. For example we have product entity,
I'm curious about best practice when developing n-tier application with Linq-to-SQL and WCF service.
Just curious what is the best practice for solving the following issue. I have
I'm curious about the best practice in creating web services which support both XML
I'm curious as to what the best practice for passing multiple parameters to a
I'm curious what would be the best practice to extend the Date constructor. The
I'm using VB's StringBuilder, and I was curious what is considered best practice for
I'm curious to know what are considered as best practice when upgrading Xcode. Say
Just curious to know what the best practice would be for something like this:

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.