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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:08:33+00:00 2026-05-20T11:08:33+00:00

I needed to wrap some Linq queries with some Retry Policy logic. Is it

  • 0

I needed to wrap some Linq queries with some Retry Policy logic.

Is it safe to pass this:

return WithRetry<User>(() => 
   dataContext.Users.Where(u => u.UserID == userID).SingleOrDefault());

to this:

public TResult WithRetry<TResult>(Func<TResult> methodCall)
{ 
   // My Try/Catch Retry Code
}

Or should the first line be constructed like this instead:

return WithRetry<User>(() => 
{ 
     return dataContext.Users
                       .Where(u => u.UserID == userID)
                       .SingleOrDefault(); 
});
  • 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-20T11:08:33+00:00Added an answer on May 20, 2026 at 11:08 am

    AFAIK, if the argument type of a method is Func, calling it will automatically pass as a function without executing it. You don’t need to further wrap it in an anonymous function wrapper.

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

Sidebar

Related Questions

I needed to wrap text inside my buttons so I found this solution: How
I needed some simple string encryption, so I wrote the following code (with a
I needed a Low-Pass-Filter in one of my Scala projects and came up with
I have written this short script (which I've stripped away some minor detail for
I am using the EF4 code first for db access. I needed to wrap
I am using TransactionScope s at a high level to wrap some high level
Some beginner help needed if anybody can.. I'm writing a contact form with a
Just wanted some quick help I'm 90% sure i need to use the (this)
Ok, i have this page and i added some jquery to slide some fields
I am trying to wrap my head around this one this morning. I am

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.