London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

Class SqlHelperParameterCache

SqlHelperParameterCache provides functions to leverage a static cache of procedure parameters, and the ability to discover parameters for stored procedures at run-time.

Inheritance
System.Object
SqlHelperParameterCache
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Mediachase.FileUploader
Assembly: Mediachase.FileUploader.dll
Version: 13.30.0
Syntax
public sealed class SqlHelperParameterCache

Methods

CacheParameterSet(String, String, SqlParameter[])

add parameter array to the cache

Declaration
public static void CacheParameterSet(string connectionString, string commandText, params SqlParameter[] commandParameters)
Parameters
Type Name Description
System.String connectionString

a valid connection string for a SqlConnection

System.String commandText

the stored procedure name or T-SQL command

System.Data.SqlClient.SqlParameter[] commandParameters

an array of SqlParamters to be cached

GetCachedParameterSet(String, String)

retrieve a parameter array from the cache

Declaration
public static SqlParameter[] GetCachedParameterSet(string connectionString, string commandText)
Parameters
Type Name Description
System.String connectionString

a valid connection string for a SqlConnection

System.String commandText

the stored procedure name or T-SQL command

Returns
Type Description
System.Data.SqlClient.SqlParameter[]

an array of SqlParamters

GetSpParameterSet(String, String)

Retrieves the set of SqlParameters appropriate for the stored procedure

Declaration
public static SqlParameter[] GetSpParameterSet(string connectionString, string spName)
Parameters
Type Name Description
System.String connectionString

a valid connection string for a SqlConnection

System.String spName

the name of the stored procedure

Returns
Type Description
System.Data.SqlClient.SqlParameter[]

an array of SqlParameters

Remarks

This method will query the database for this information, and then store it in a cache for future requests.

GetSpParameterSet(String, String, Boolean)

Retrieves the set of SqlParameters appropriate for the stored procedure

Declaration
public static SqlParameter[] GetSpParameterSet(string connectionString, string spName, bool includeReturnValueParameter)
Parameters
Type Name Description
System.String connectionString

a valid connection string for a SqlConnection

System.String spName

the name of the stored procedure

System.Boolean includeReturnValueParameter

a bool value indicating whether the return value parameter should be included in the results

Returns
Type Description
System.Data.SqlClient.SqlParameter[]

an array of SqlParameters

Remarks

This method will query the database for this information, and then store it in a cache for future requests.