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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:25:10+00:00 2026-05-27T09:25:10+00:00

I have two queries: member private x.CheckIfUserExistsUsingId(userId:int, context:StoryBoardContext) = <@ context.Users |> Seq.exists (fun

  • 0

I have two queries:

 member private x.CheckIfUserExistsUsingId(userId:int, context:StoryBoardContext) =
  <@ context.Users 
     |> Seq.exists (fun currentUser -> currentUser.Id = userId) @>

And

member private x.FindUserById(userId:int, context:StoryBoardContext) =
 <@ context.Users 
    |> Seq.filter(fun currentUser -> currentUser.Id = userId) 
    |> Seq.head @>

I’d like to refactor this so that the two

 fun currentUser -> currentUser.Id = userId

Can be one method like:

member private x.IfUserIdMatches (userId:int) = 
  fun (currentUser:User) -> currentUser.Id = userId

And then use it:

member private x.CheckIfUserExistsUsingId(userId:int, context:StoryBoardContext) =
  <@ context.Users 
     |> Seq.exists (x.IfUserIdMatches (userId)) @>

But I keep getting an error:

The following construct was used in query but is not recognised by the F#-to-LINQ query translator...

Which makes me think my signature for the method is poorly constructed. Being new to F# it has me a little confused since I’m positive this can be done in C# using a method that returns a Func. However, I understand that there are differences right off the bat since F# is using a different library to construct linq queries.

  • 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-27T09:25:11+00:00Added an answer on May 27, 2026 at 9:25 am

    Does it work if you change your method to return Expr

    member private x.IfUserIdMatches (userId:int) = 
      <@ fun (currentUser:User) -> currentUser.Id = userId @>
    

    and use splicing?

    member private x.CheckIfUserExistsUsingId(userId:int, context:StoryBoardContext) =
      <@ context.Users 
          |> Seq.exists %(x.IfUserIdMatches (userId)) @>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two queries, as following: SELECT SQL_CALC_FOUND_ROWS Id, Name FROM my_table WHERE Name
I'm seeing OraclePreparedStatement executeQuery() exhibit serialization. That is, I have two queries that I
I have two mysql queries: $sql = SELECT * FROM content WHERE threadName LIKE
I have the following two queries: select count(*) from segmentation_cycle_recipients scr , segmentation_instance si
I have a query to select from another sub-query select. While the two queries
I have two queries, the only difference being the GROUP BY clause SELECT *
i have two queries, querying the same table, but based on different parameters, i
I have these two SQL queries at the top of every page on my
I have two tables users registered_members I want to confirm values from user table
I have two queries that I want to be able to run on a

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.