Table of Contents

Method FirstOrDefault

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

FirstOrDefault<T>(IMappedQuery<T>)

Reads the first mapped row.

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

Parameters

query IMappedQuery<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.

See Also