Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

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
Namespace: Mediachase.BusinessFoundation.Data.Sql
Assembly: Mediachase.BusinessFoundation.Data.dll
Version: 14.26.0
Syntax
public class SqlHelperParameterCache : Object

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

Microsoft.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
Microsoft.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
Microsoft.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
Microsoft.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.