Table of Contents

Method SingleOrDefault

Namespace
Open.Database.Extensions.Synchronous
Assembly
Open.Database.Extensions.Core.dll

SingleOrDefault<T>(MappedQuery<T>)

Reads the only mapped row.

public static T? SingleOrDefault<T>(this MappedQuery<T> query)

Parameters

query MappedQuery<T>

The query to execute.

Returns

T

The single row, or default if the query returns no rows.

Type Parameters

T

The type each row is mapped to.

Exceptions

ArgumentNullException

query is null.

InvalidOperationException

The query returns more than one row.

See Also
FirstOrDefault()

SingleOrDefault<T>(MappedQueryWithSkip<T>)

Reads the only mapped row.

public static T? SingleOrDefault<T>(this MappedQueryWithSkip<T> query)

Parameters

query MappedQueryWithSkip<T>

The query to execute.

Returns

T

The single row, or default if the query returns no rows.

Type Parameters

T

The type each row is mapped to.

Exceptions

ArgumentNullException

query is null.

InvalidOperationException

The query returns more than one row.

See Also
FirstOrDefault()

SingleOrDefault<T>(MappedQueryWithTake<T>)

Reads the only mapped row.

public static T? SingleOrDefault<T>(this MappedQueryWithTake<T> query)

Parameters

query MappedQueryWithTake<T>

The query to execute.

Returns

T

The single row, or default if the query returns no rows.

Type Parameters

T

The type each row is mapped to.

Exceptions

ArgumentNullException

query is null.

InvalidOperationException

The query returns more than one row.

See Also
FirstOrDefault()

SingleOrDefault<T>(MappedCommand<T>)

Reads the only mapped row.

public static T? SingleOrDefault<T>(this MappedCommand<T> query)

Parameters

query MappedCommand<T>

The query to execute.

Returns

T

The single row, or default if the query returns no rows.

Type Parameters

T

The type each row is mapped to.

Exceptions

ArgumentNullException

query is null.

InvalidOperationException

The query returns more than one row.

See Also
FirstOrDefault()