Table of Contents

Method FirstOrDefault

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

FirstOrDefault<T>(MappedQuery<T>)

Reads the first mapped row.

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

Parameters

query MappedQuery<T>

The query to execute.

Returns

T

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

Type Parameters

T

The type each row is mapped to.

Remarks

Rows after the first are not mapped. Add an ORDER BY to the SQL when "first" must be deterministic.

Exceptions

ArgumentNullException

query is null.

See Also
SingleOrDefault()

FirstOrDefault<T>(MappedQueryWithSkip<T>)

Reads the first mapped row.

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

Parameters

query MappedQueryWithSkip<T>

The query to execute.

Returns

T

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

Type Parameters

T

The type each row is mapped to.

Remarks

Rows after the first are not mapped. Add an ORDER BY to the SQL when "first" must be deterministic.

Exceptions

ArgumentNullException

query is null.

See Also
SingleOrDefault()

FirstOrDefault<T>(MappedQueryWithTake<T>)

Reads the first mapped row.

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

Parameters

query MappedQueryWithTake<T>

The query to execute.

Returns

T

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

Type Parameters

T

The type each row is mapped to.

Remarks

Rows after the first are not mapped. Add an ORDER BY to the SQL when "first" must be deterministic.

Exceptions

ArgumentNullException

query is null.

See Also
SingleOrDefault()

FirstOrDefault<T>(MappedCommand<T>)

Reads the first mapped row.

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

Parameters

query MappedCommand<T>

The query to execute.

Returns

T

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

Type Parameters

T

The type each row is mapped to.

Remarks

Rows after the first are not mapped. Add an ORDER BY to the SQL when "first" must be deterministic.

Exceptions

ArgumentNullException

query is null.

See Also
SingleOrDefault()