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
queryMappedQuery<T>The query to execute.
Returns
- T
The single row, or default if the query returns no rows.
Type Parameters
TThe type each row is mapped to.
Exceptions
- ArgumentNullException
queryis 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
queryMappedQueryWithSkip<T>The query to execute.
Returns
- T
The single row, or default if the query returns no rows.
Type Parameters
TThe type each row is mapped to.
Exceptions
- ArgumentNullException
queryis 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
queryMappedQueryWithTake<T>The query to execute.
Returns
- T
The single row, or default if the query returns no rows.
Type Parameters
TThe type each row is mapped to.
Exceptions
- ArgumentNullException
queryis 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
queryMappedCommand<T>The query to execute.
Returns
- T
The single row, or default if the query returns no rows.
Type Parameters
TThe type each row is mapped to.
Exceptions
- ArgumentNullException
queryis null.- InvalidOperationException
The query returns more than one row.
- See Also
-
FirstOrDefault()