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
queryIMappedQuery<T>The query to execute.
Returns
- T
The first row, or default if the query returns no rows.
Type Parameters
TThe 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
-
SingleOrDefault<T>(IMappedQuery<T>)