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
Inherited Members
Namespace: Mediachase.BusinessFoundation.Data.Sql
Assembly: Mediachase.BusinessFoundation.Data.dll
Version: 12.17.2Syntax
public 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.