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
queryMappedQuery<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.
Exceptions
- ArgumentNullException
queryis null.
- See Also
-
SingleOrDefault()
FirstOrDefault<T>(MappedQueryWithSkip<T>)
Reads the first mapped row.
public static T? FirstOrDefault<T>(this MappedQueryWithSkip<T> query)
Parameters
queryMappedQueryWithSkip<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.
Exceptions
- ArgumentNullException
queryis null.
- See Also
-
SingleOrDefault()
FirstOrDefault<T>(MappedQueryWithTake<T>)
Reads the first mapped row.
public static T? FirstOrDefault<T>(this MappedQueryWithTake<T> query)
Parameters
queryMappedQueryWithTake<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.
Exceptions
- ArgumentNullException
queryis null.
- See Also
-
SingleOrDefault()
FirstOrDefault<T>(MappedCommand<T>)
Reads the first mapped row.
public static T? FirstOrDefault<T>(this MappedCommand<T> query)
Parameters
queryMappedCommand<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.
Exceptions
- ArgumentNullException
queryis null.
- See Also
-
SingleOrDefault()