Class DbCommandExtensions
Useful extension methods for System.Data.IDbCommand.
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
Namespace: IRM.Data
Assembly: IRM.dll
Syntax
public static class DbCommandExtensions
Methods
As<T>(IDbCommand, CommandBehavior, Func<IDataRecord, T>)
Executes a command and returns a single result as a collection of the specified type.
Declaration
public static IEnumerable<T> As<T>(this IDbCommand command, CommandBehavior commandBehavior, Func<IDataRecord, T> translate)
Parameters
System.Data.IDbCommand
command
The command to execute. |
System.Data.CommandBehavior
commandBehavior
|
System.Func<System.Data.IDataRecord, T>
translate
|
Returns
IEnumerable<T>
|
Type Parameters
T
|
Remarks
This operation will always add System.Data.CommandBehavior.SingleResult to commandBehavior
, since it only can handle a singe result set.
As<T>(IDbCommand, Func<IDataRecord, T>)
Executes a command and returns a single result as a collection of the specified type.
Declaration
public static IEnumerable<T> As<T>(this IDbCommand command, Func<IDataRecord, T> translate)
Parameters
System.Data.IDbCommand
command
The command to execute. |
System.Func<System.Data.IDataRecord, T>
translate
|
Returns
IEnumerable<T>
|
Type Parameters
T
|
Remarks
This operation will always execute with the System.Data.CommandBehavior System.Data.CommandBehavior.SingleResult and System.Data.CommandBehavior.CloseConnection.