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?