Table of Contents

Interface IDataQuery

Namespace
FluentCommand
Assembly
FluentCommand.dll

An interface defining a data query operations.

public interface IDataQuery : IDisposable
Inherited Members
Extension Methods

Methods

QuerySingle<TEntity>(Func<IDataReader, TEntity>, CommandBehavior)

Executes the query and returns the first row in the result as a TEntity object.

TEntity QuerySingle<TEntity>(Func<IDataReader, TEntity> factory, CommandBehavior commandBehavior = CommandBehavior.SingleResult | CommandBehavior.SingleRow)

Parameters

factory Func<IDataReader, TEntity>

The delegate factory to convert the IDataReader to TEntity.

commandBehavior CommandBehavior

Provides a description of the results of the query and its effect on the database.

Returns

TEntity

A instance of TEntity if row exists; otherwise null.

Type Parameters

TEntity

The type of the entity.

QueryTable()

Executes the command against the connection and converts the results to a DataTable.

DataTable QueryTable()

Returns

DataTable

A DataTable of the results.

QueryValue<TValue>(Func<object, TValue>)

Executes the query and returns the first column of the first row in the result set returned by the query. All other columns and rows are ignored.

TValue QueryValue<TValue>(Func<object, TValue> convert)

Parameters

convert Func<object, TValue>

The delegate to convert the value..

Returns

TValue

The value of the first column of the first row in the result set.

Type Parameters

TValue

The type of the value.

Query<TEntity>(Func<IDataReader, TEntity>, CommandBehavior)

Executes the command against the connection and converts the results to TEntity objects.

IEnumerable<TEntity> Query<TEntity>(Func<IDataReader, TEntity> factory, CommandBehavior commandBehavior = CommandBehavior.SingleResult)

Parameters

factory Func<IDataReader, TEntity>

The delegate factory to convert the IDataReader to TEntity.

commandBehavior CommandBehavior

Provides a description of the results of the query and its effect on the database.

Returns

IEnumerable<TEntity>

An IEnumerable<T> of TEntity objects.

Type Parameters

TEntity

The type of the entity.

Read(Action<IDataReader>, CommandBehavior)

Executes the command against the connection and sends the resulting IDataReader to the readAction delegate.

void Read(Action<IDataReader> readAction, CommandBehavior commandBehavior = CommandBehavior.Default)

Parameters

readAction Action<IDataReader>

The read action delegate to pass the open IDataReader.

commandBehavior CommandBehavior

Provides a description of the results of the query and its effect on the database.