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

The Archive Base Latest Questions

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

I want to change the following use of SqlParameter into a more typed version

  • 0

I want to change the following use of SqlParameter into a more typed version

private static void Update(int id, string lname)
{
  new RememberEntities().ExecuteStoreCommand(
    @"    UPDATE Users
          SET lname = @lname 
          WHERE Id = @id",
    new SqlParameter("lname", lname), new SqlParameter("id", id));
}

For example, I want to be able to write something a long the lines of:

private static void Update(int id, string lname)
{
  new RememberEntities().ExecuteStoreCommand(
    @"    UPDATE Users
          SET lname = @lname 
          WHERE Id = @id",
    new SqlParameterString("lname", lname), new SqlParameterInt("id", id));
}

Where the second parameter to SqlParameterString() would take a string and an int in the case of SqlParameterInt(). I’ve tried creating my own by subclassing SqlParameter, alas, it is sealed so no luck there.

I was wondering what is the recommended EF apprach?

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

    You can create typed factory methods and use only them, but you really can’t avoid using SqlParameter constructor directly (you’ll have this problem even if SqlParameter would be not sealed, you can only create your own wrapper method in such case).

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

Sidebar

Related Questions

I have a following query and I want to change that query into PyES:
I have the following Select statement, but want to change it to use iner
I want change following javascript code to jquery code, How is it? With done
Suppose I want to change the orange node in the following tree. So, the
I had following cgridview in Yii application, I want to change date format in
I have the following property public MyType MyProperty {get;set;} I want to change this
I have date in sting object in following format. dd/mm/yyyy I want to change
I'm using the following code. The code works, but I want to change it
I want to dynamically change content , by following code. localStorage.removeItem(some key); but current
Learning sed, I want to change the drive letter of the following input lines

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.