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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:20:13+00:00 2026-05-25T16:20:13+00:00

Is there any chance to run c# method in linq query? I need to

  • 0

Is there any chance to run c# method in linq query?
I need to do something like that:

//...
class Match {
  public double PrecentageMatching(string s1, string s2) {
    //...
    return result; // value from 0.0 to 1.0
  }
}
//...

string pattern = "nameOfRecord";
var similarRecords = db.Table.Select( 
   r => Match.PrecentageMatching(r.name, pattern) > 0.5 
);

I know that there linq wont know a method PrecentageMatching. But I’m wonder if there is any way to do it?

I’m using Entity framework.
I need to do it without stored procedures and assembly on database side. I dont have access to database.

  • 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-25T16:20:14+00:00Added an answer on May 25, 2026 at 4:20 pm

    You first need to fetch the data from the database and only then perform the transformation:

    string pattern = "nameOfRecord";
    var similarRecords = db.Table
                           .Select(r => r.name)
                           .ToList() // This call fetches the data from the DB
                           .Select(x => Match.PrecentageMatching(x, pattern) > 0.5);
    

    That’s not a problem at all, because you are only transforming the returned data with your method. If you want to use your method to filter the returned data using Where, you have a problem, because you would first need to return ALL data and filter the data on your client. This might be a problem if the table is big.

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

Sidebar

Related Questions

Is there any chance that a SHA-1 hash can be purely numeric, or does
Do you know how OpenUDID generate unique device ID? Is there any chance that
Is there any chance I'll run into trouble checking coverage with release code in
Is there any chance to get this work? I want my tests to be
By any chance, is there any easy way to set a default MasterView for
Is there by any chance a way to set shipping cost by state in
I have method that run many times. I dont want to nest ifs inside
I have a class that has two method in it, one calls a class
Is there any standard/backend-independent method for querying pending tasks based on certain fields? For
I have a query in Delphi using DBExpress TSQLQuery that looks like so ActiveSQL.sql.add('SELECT

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.