November Happy Hour will be moved to Thursday December 5th.

Class DataHelper

Provides access to database data.

Inheritance
System.Object
DataHelper
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.BusinessFoundation.Data
Assembly: Mediachase.BusinessFoundation.Data.dll
Version: 12.17.2
Syntax
public static class DataHelper

Properties

TempSPExpiration

Gets or sets the sp item expiration.

Declaration
public static int TempSPExpiration { get; set; }
Property Value
Type Description
System.Int32

The sp item expiration.

Remarks

Default value is 20160 minutes (14 days).

UseSPOptimization

Gets or sets a value indicating whether [use sp mode].

Declaration
public static bool UseSPOptimization { get; set; }
Property Value
Type Description
System.Boolean

true if [use sp mode]; otherwise, false.

Methods

CheckTempSP(String, String)

Checks the temp sp.

Declaration
public static bool CheckTempSP(string tempSPName, string tempSPCreateScript)
Parameters
Type Name Description
System.String tempSPName

Name of the temp sp.

System.String tempSPCreateScript

The temp sp create script.

Returns
Type Description
System.Boolean

CleanUpTempSP()

Cleans up temp sp.

Declaration
public static void CleanUpTempSP()

CleanUpTempSP(DateTime)

Cleans up temp sp.

Declaration
public static void CleanUpTempSP(DateTime expirationDate)
Parameters
Type Name Description
System.DateTime expirationDate

The expiration date.

Delete(TableConfig, Dictionary<String, Object>)

Declaration
public static void Delete(TableConfig config, Dictionary<string, object> values)
Parameters
Type Name Description
TableConfig config
System.Collections.Generic.Dictionary<System.String, System.Object> values

Delete(String, String, PrimaryKeyId)

Deletes the specified table name.

Declaration
public static void Delete(string tableName, string keyName, PrimaryKeyId key)
Parameters
Type Name Description
System.String tableName

Name of the table.

System.String keyName

Name of the key.

PrimaryKeyId key

The key.

Delete(String, String, SqlDbType, Object)

Deletes the specified table name.

Declaration
public static void Delete(string tableName, string keyName, SqlDbType dbType, object key)
Parameters
Type Name Description
System.String tableName

Name of the table.

System.String keyName

Name of the key.

System.Data.SqlDbType dbType

Type of the db.

System.Object key

The key.

GetDataTable(TableConfig)

Gets the data table.

Declaration
public static DataTable GetDataTable(TableConfig tableConfig)
Parameters
Type Name Description
TableConfig tableConfig

The table config.

Returns
Type Description
System.Data.DataTable

GetDataTable(TableConfig, FilterElement[])

Gets the data table.

Declaration
public static DataTable GetDataTable(TableConfig tableConfig, params FilterElement[] filters)
Parameters
Type Name Description
TableConfig tableConfig

The table config.

FilterElement[] filters

The filters.

Returns
Type Description
System.Data.DataTable

GetDataTable(String)

Gets the data table.

Declaration
public static DataTable GetDataTable(string tableName)
Parameters
Type Name Description
System.String tableName

Name of the table.

Returns
Type Description
System.Data.DataTable

GetDataTable(String, FilterElement[])

Gets the data table.

Declaration
public static DataTable GetDataTable(string tableName, params FilterElement[] filters)
Parameters
Type Name Description
System.String tableName

Name of the table.

FilterElement[] filters

The filters.

Returns
Type Description
System.Data.DataTable

GetTempSPDeleteName(SqlCommandBuilder)

Gets the name of the temp stporage procedure delete.

Declaration
public static string GetTempSPDeleteName(SqlCommandBuilder sb)
Parameters
Type Name Description
SqlCommandBuilder sb

The sb.

Returns
Type Description
System.String

GetTempSPInsertName(SqlCommandBuilder)

Gets the name of the temp sp insert.

Declaration
public static string GetTempSPInsertName(SqlCommandBuilder sb)
Parameters
Type Name Description
SqlCommandBuilder sb

The sb.

Returns
Type Description
System.String

GetTempSPListName(SqlCommandBuilder)

Gets the name of the temp sp list.

Declaration
public static string GetTempSPListName(SqlCommandBuilder sb)
Parameters
Type Name Description
SqlCommandBuilder sb

The sb.

Returns
Type Description
System.String

GetTempSPListName(String, Int32)

Gets the name of the temp sp list.

Declaration
public static string GetTempSPListName(string primaryTableName, int scriptHashCode)
Parameters
Type Name Description
System.String primaryTableName

Name of the primary table.

System.Int32 scriptHashCode

The script hash code.

Returns
Type Description
System.String

GetTempSPUpdateName(SqlCommandBuilder)

Gets the name of the temp sp update.

Declaration
public static string GetTempSPUpdateName(SqlCommandBuilder sb)
Parameters
Type Name Description
SqlCommandBuilder sb

The sb.

Returns
Type Description
System.String

GetTotalCount(String, FilterElement[])

Gets the total count.

Declaration
public static int GetTotalCount(string tableName, params FilterElement[] filters)
Parameters
Type Name Description
System.String tableName

Name of the table.

FilterElement[] filters

The filters.

Returns
Type Description
System.Int32

Insert(TableConfig, Dictionary<String, Object>)

Declaration
public static PrimaryKeyId Insert(TableConfig config, Dictionary<string, object> values)
Parameters
Type Name Description
TableConfig config
System.Collections.Generic.Dictionary<System.String, System.Object> values
Returns
Type Description
PrimaryKeyId

Insert(String, SqlParameter[])

Inserts the specified table name.

Declaration
public static void Insert(string tableName, params SqlParameter[] parameters)
Parameters
Type Name Description
System.String tableName

Name of the table.

System.Data.SqlClient.SqlParameter[] parameters

The parameters.

Insert(String, String, SqlParameter[])

Inserts the specified table name.

Declaration
public static PrimaryKeyId Insert(string tableName, string keyName, params SqlParameter[] parameters)
Parameters
Type Name Description
System.String tableName

Name of the table.

System.String keyName

Name of the key.

System.Data.SqlClient.SqlParameter[] parameters

The parameters.

Returns
Type Description
PrimaryKeyId

List(TableConfig)

Lists the specified table config.

Declaration
public static IDataReader List(TableConfig tableConfig)
Parameters
Type Name Description
TableConfig tableConfig

The table config.

Returns
Type Description
System.Data.IDataReader

List(TableConfig, FilterElement[])

Lists the specified table config.

Declaration
public static IDataReader List(TableConfig tableConfig, params FilterElement[] filters)
Parameters
Type Name Description
TableConfig tableConfig

The table config.

FilterElement[] filters

The filters.

Returns
Type Description
System.Data.IDataReader

List(TableConfig, FilterElementCollection, SortingElementCollection)

Lists the specified table config.

Declaration
public static IDataReader List(TableConfig tableConfig, FilterElementCollection filters, SortingElementCollection sorting)
Parameters
Type Name Description
TableConfig tableConfig

The table config.

FilterElementCollection filters

The filters.

SortingElementCollection sorting

The sorting.

Returns
Type Description
System.Data.IDataReader

List(TableConfig, SortingElement[])

Lists the specified table config.

Declaration
public static IDataReader List(TableConfig tableConfig, params SortingElement[] sorting)
Parameters
Type Name Description
TableConfig tableConfig

The table config.

SortingElement[] sorting

The sorting.

Returns
Type Description
System.Data.IDataReader

List(TableConfig, Int32)

Lists the specified table config.

Declaration
[Obsolete("This method is no longer used. Use overload with proper paging instead. Will remain at least until November 2019.")]
public static IDataReader List(TableConfig tableConfig, int maxCount)
Parameters
Type Name Description
TableConfig tableConfig

The table config.

System.Int32 maxCount

The max count.

Returns
Type Description
System.Data.IDataReader

List(TableConfig, Int32, FilterElement[])

Lists the specified table config.

Declaration
[Obsolete("This method is no longer used. Use overload with proper paging instead. Will remain at least until November 2019.")]
public static IDataReader List(TableConfig tableConfig, int maxCount, params FilterElement[] filters)
Parameters
Type Name Description
TableConfig tableConfig

The table config.

System.Int32 maxCount

The max count.

FilterElement[] filters

The filters.

Returns
Type Description
System.Data.IDataReader

List(TableConfig, Int32, FilterElementCollection, SortingElementCollection)

Lists the specified table config.

Declaration
[Obsolete("This method is no longer used. Use overload with proper paging instead. Will remain at least until November 2019.")]
public static IDataReader List(TableConfig tableConfig, int maxCount, FilterElementCollection filters, SortingElementCollection sorting)
Parameters
Type Name Description
TableConfig tableConfig

The table config.

System.Int32 maxCount

The max count.

FilterElementCollection filters

The filters.

SortingElementCollection sorting

The sorting.

Returns
Type Description
System.Data.IDataReader

List(TableConfig, Int32, SortingElement[])

Lists the specified table config.

Declaration
[Obsolete("This method is no longer used. Use overload with proper paging instead. Will remain at least until November 2019.")]
public static IDataReader List(TableConfig tableConfig, int maxCount, params SortingElement[] sorting)
Parameters
Type Name Description
TableConfig tableConfig

The table config.

System.Int32 maxCount

The max count.

SortingElement[] sorting

The sorting.

Returns
Type Description
System.Data.IDataReader

List(TableConfig, Int32, Int32, FilterElementCollection, SortingElementCollection)

Lists the specified table config.

Declaration
public static IDataReader List(TableConfig tableConfig, int startIndex, int recordsCount, FilterElementCollection filters, SortingElementCollection sorting)
Parameters
Type Name Description
TableConfig tableConfig

The table config.

System.Int32 startIndex

The start index.

System.Int32 recordsCount

The records count.

FilterElementCollection filters

The filters.

SortingElementCollection sorting

The sorting.

Returns
Type Description
System.Data.IDataReader

List(String)

Lists the specified table name.

Declaration
public static IDataReader List(string tableName)
Parameters
Type Name Description
System.String tableName

Name of the table.

Returns
Type Description
System.Data.IDataReader

List(String, FilterElement[])

Lists the specified table name.

Declaration
public static IDataReader List(string tableName, params FilterElement[] filters)
Parameters
Type Name Description
System.String tableName

Name of the table.

FilterElement[] filters

The filters.

Returns
Type Description
System.Data.IDataReader

List(String, FilterElementCollection, SortingElementCollection)

Lists the specified table name.

Declaration
public static IDataReader List(string tableName, FilterElementCollection filters, SortingElementCollection sorting)
Parameters
Type Name Description
System.String tableName

Name of the table.

FilterElementCollection filters

The filters.

SortingElementCollection sorting

The sorting.

Returns
Type Description
System.Data.IDataReader

List(String, SortingElement[])

Lists the specified table name.

Declaration
public static IDataReader List(string tableName, params SortingElement[] sorting)
Parameters
Type Name Description
System.String tableName

Name of the table.

SortingElement[] sorting

The sorting.

Returns
Type Description
System.Data.IDataReader

List(String, Int32)

Lists the specified table name.

Declaration
[Obsolete("This method is no longer used. Use overload with proper paging instead. Will remain at least until November 2019.")]
public static IDataReader List(string tableName, int maxCount)
Parameters
Type Name Description
System.String tableName

Name of the table.

System.Int32 maxCount

The max count.

Returns
Type Description
System.Data.IDataReader

List(String, Int32, FilterElement[])

Lists the specified table name.

Declaration
[Obsolete("This method is no longer used. Use overload with proper paging instead. Will remain at least until November 2019.")]
public static IDataReader List(string tableName, int maxCount, params FilterElement[] filters)
Parameters
Type Name Description
System.String tableName

Name of the table.

System.Int32 maxCount

The max count.

FilterElement[] filters

The filters.

Returns
Type Description
System.Data.IDataReader

List(String, Int32, FilterElementCollection, SortingElementCollection)

Lists the specified table name.

Declaration
[Obsolete("This method is no longer used. Use overload with proper paging instead. Will remain at least until November 2019.")]
public static IDataReader List(string tableName, int maxCount, FilterElementCollection filters, SortingElementCollection sorting)
Parameters
Type Name Description
System.String tableName

Name of the table.

System.Int32 maxCount

The max count.

FilterElementCollection filters

The filters.

SortingElementCollection sorting

The sorting.

Returns
Type Description
System.Data.IDataReader

List(String, Int32, SortingElement[])

Lists the specified table name.

Declaration
[Obsolete("This method is no longer used. Use overload with proper paging instead. Will remain at least until November 2019.")]
public static IDataReader List(string tableName, int maxCount, params SortingElement[] sorting)
Parameters
Type Name Description
System.String tableName

Name of the table.

System.Int32 maxCount

The max count.

SortingElement[] sorting

The sorting.

Returns
Type Description
System.Data.IDataReader

List(String, Int32, Int32, FilterElementCollection, SortingElementCollection)

Lists the specified table name.

Declaration
public static IDataReader List(string tableName, int startIndex, int recordsCount, FilterElementCollection filters, SortingElementCollection sorting)
Parameters
Type Name Description
System.String tableName

Name of the table.

System.Int32 startIndex

The max count.

System.Int32 recordsCount

The records count.

FilterElementCollection filters

The filters.

SortingElementCollection sorting

The sorting.

Returns
Type Description
System.Data.IDataReader

RemoveTempSP(String)

Removes the temp sp.

Declaration
public static void RemoveTempSP(string tempSPName)
Parameters
Type Name Description
System.String tempSPName

Name of the temp sp.

Select(String, String, SqlDbType, Object)

Selects the specified table name.

Declaration
public static IDataReader Select(string tableName, string keyName, SqlDbType dbType, object key)
Parameters
Type Name Description
System.String tableName

Name of the table.

System.String keyName

Name of the key.

System.Data.SqlDbType dbType

Type of the db.

System.Object key

The key.

Returns
Type Description
System.Data.IDataReader

Select(String, String, Int32)

Selects the specified table name.

Declaration
public static IDataReader Select(string tableName, string keyName, int key)
Parameters
Type Name Description
System.String tableName

Name of the table.

System.String keyName

Name of the key.

System.Int32 key

The key.

Returns
Type Description
System.Data.IDataReader

Update(TableConfig, Dictionary<String, Object>)

Declaration
public static void Update(TableConfig config, Dictionary<string, object> values)
Parameters
Type Name Description
TableConfig config
System.Collections.Generic.Dictionary<System.String, System.Object> values

Update(String, SqlParameter[])

Updates the specified table name.

Declaration
public static void Update(string tableName, params SqlParameter[] parameters)
Parameters
Type Name Description
System.String tableName

Name of the table.

System.Data.SqlClient.SqlParameter[] parameters

The parameters.