Utility library for common data operations.
Westwind.Utilities.DataUtils
public static class DataUtils : object
Class Members
Member | Description | |
---|---|---|
MemberAccess |
||
MemberPublicInstanceAccess |
||
MinimumSqlDate |
The default SQL date used by InitializeDataRowWithBlanks. Considered a blank date instead of null. | |
CloseConnection |
Closes a connection public static void CloseConnection(SqlCommand Command) |
|
CopyDataRow |
Copies the content of a data row to another. Runs through the target's fields and looks for fields of the same name in the source row. Structure must mathc or fields are skipped. public static bool CopyDataRow(DataRow source, DataRow target) |
|
CopyObjectData |
Copies the content of one object to another. The target object 'pulls' properties of the first. public static void CopyObjectData(object source, object target) public static void CopyObjectData(object source, object target, BindingFlags memberAccess) public static void CopyObjectData(object source, object target, string excludedProperties) public static void CopyObjectData(object source, object target, string excludedProperties, BindingFlags memberAccess) |
|
CopyObjectFromDataRow |
public static void CopyObjectFromDataRow(DataRow row, object targetObject) |
|
CopyObjectToDataRow |
Copies the content of an object to a DataRow with matching field names. Both properties and fields are copied. If a field copy fails due to a type mismatch copying continues but the method returns false public static bool CopyObjectToDataRow(DataRow row, object target) |
|
DataReaderToIEnumerable<T> |
Creates an IEnumerable of T from an open DataReader instance. public static IEnumerable |
|
DataReaderToObject |
Populates the properties of an object from a single DataReader row using Reflection by matching the DataReader fields to a public property on the object passed in. Unmatched properties are left unchanged. public static void DataReaderToObject(IDataReader reader, object instance, string fieldsToSkip, Dictionary<String,PropertyInfo> piList) |
|
DataReaderToObjectList<T> |
Creates a list of a given type from all the rows in a DataReader. public static List |
|
DbTypeToDotNetType |
Maps a DbType to a .NET native type public static Type DbTypeToDotNetType(DbType sqlType) |
|
DotNetTypeToDbType |
Converts a .NET type into a DbType value public static DbType DotNetTypeToDbType(Type type) |
|
DotNetTypeToSqlType |
Converts a .NET type into a SqlDbType. public static SqlDbType DotNetTypeToSqlType(Type type) |
|
GenerateUniqueId |
public static string GenerateUniqueId(int stringSize) |
|
GenerateUniqueNumericId |
public static long GenerateUniqueNumericId() |
|
GetDataTable |
Returns a DataTable from a Sql Command string passed in. public static DataTable GetDataTable(string Tablename, string ConnectionString, string Sql, SqlParameter[] Parameters) |
|
GetRandomNumber |
Returns a random integer in a range of numbers a single seed value. public static int GetRandomNumber(int min, int max) |
|
GetSqlCommand |
Creates a Command object and opens a connection public static SqlCommand GetSqlCommand(string ConnectionString, string Sql, SqlParameter[] Parameters) |
|
GetSqlDataReader |
Returns a SqlDataReader object from a SQL string. public static SqlDataReader GetSqlDataReader(string ConnectionString, string Sql, SqlParameter[] Parameters) |
|
InitializeDataRowWithBlanks |
Initializes a Datarow containing NULL values with 'empty' values instead. Empty values are: String - "" all number types - 0 or 0.00 DateTime - Value of MinimumSqlData (1/1/1900 by default); Boolean - false Binary values and timestamps are left alone public static void InitializeDataRowWithBlanks(DataRow row) |
|
SqlTypeToDotNetType |
Maps a SqlDbType to a .NET type public static Type SqlTypeToDotNetType(SqlDbType sqlType) |
Requirements
Namespace: Westwind.UtilitiesAssembly: westwind.utilities.dll
© West Wind Technologies, 1996-2016 • Updated: 12/12/15
Comment or report problem with topic