SqlSet Class
Represents an immutable, connected SQL query. This class cannot be instantiated, to get an instance use one of the Database.From or Database.FromQuery overloads.
Inheritance Hierarchy
System.Object
DbExtensions.SqlSet
DbExtensions.SqlSet<TResult>
DbExtensions.SqlTable
Namespace: DbExtensions
Assembly: DbExtensions.dll
Syntax
public class SqlSet
The SqlSet type exposes the following members.
Properties
| Name | Description |
|---|---|
| Database | The Database this set is connected to. |
| ResultType | The type of objects this set returns. This property can be null. |
Methods
| Name | Description |
|---|---|
| All(OperatorStringHandler) | Determines whether all elements of the set satisfy a condition. |
| All(String) | Determines whether all elements of the set satisfy a condition. |
| AllAsync(OperatorStringHandler, CancellationToken) | Determines whether all elements of the set satisfy a condition. |
| AllAsync(String, CancellationToken) | Determines whether all elements of the set satisfy a condition. |
| Any() | Determines whether the set contains any elements. |
| Any(OperatorStringHandler) | Determines whether any element of the set satisfies a condition. |
| Any(String) | Determines whether any element of the set satisfies a condition. |
| AnyAsync(CancellationToken) | Determines whether the set contains any elements. |
| AnyAsync(OperatorStringHandler, CancellationToken) | Determines whether any element of the set satisfies a condition. |
| AnyAsync(String, CancellationToken) | Determines whether any element of the set satisfies a condition. |
| AsAsyncEnumerable | Gets all elements in the set. The query is deferred-executed. |
| AsEnumerable | Gets all elements in the set. The query is deferred-executed. |
| Cast(Type) | Casts the elements of the set to the specified type. |
| Cast<TResult>() | Casts the elements of the set to the specified type. |
| Contains | Checks the existance of the entity, using the primary key value. |
| ContainsAsync | Checks the existance of the entity, using the primary key value. |
| ContainsKey | Checks the existance of an entity whose primary matches the id parameter. |
| ContainsKeyAsync | Checks the existance of an entity whose primary matches the id parameter. |
| Count() | Returns the number of elements in the set. |
| Count(OperatorStringHandler) | Returns a number that represents how many elements in the set satisfy a condition. |
| Count(String) | Returns a number that represents how many elements in the set satisfy a condition. |
| CountAsync(CancellationToken) | Returns the number of elements in the set. |
| CountAsync(OperatorStringHandler, CancellationToken) | Returns a number that represents how many elements in the set satisfy a condition. |
| CountAsync(String, CancellationToken) | Returns a number that represents how many elements in the set satisfy a condition. |
| Find | Gets the entity whose primary key matches the id parameter. |
| FindAsync | Gets the entity whose primary key matches the id parameter. |
| First() | Returns the first element of the set. |
| First(OperatorStringHandler) | Returns the first element in the set that satisfies a specified condition. |
| First(String) | Returns the first element in the set that satisfies a specified condition. |
| FirstAsync(CancellationToken) | Returns the first element of the set. |
| FirstAsync(OperatorStringHandler, CancellationToken) | Returns the first element in the set that satisfies a specified condition. |
| FirstAsync(String, CancellationToken) | Returns the first element in the set that satisfies a specified condition. |
| FirstOrDefault() | Returns the first element of the set, or a default value if the set contains no elements. |
| FirstOrDefault(OperatorStringHandler) | Returns the first element of the set that satisfies a condition or a default value if no such element is found. |
| FirstOrDefault(String) | Returns the first element of the set that satisfies a condition or a default value if no such element is found. |
| FirstOrDefaultAsync(CancellationToken) | Returns the first element of the set, or a default value if the set contains no elements. |
| FirstOrDefaultAsync(OperatorStringHandler, CancellationToken) | Returns the first element of the set that satisfies a condition or a default value if no such element is found. |
| FirstOrDefaultAsync(String, CancellationToken) | Returns the first element of the set that satisfies a condition or a default value if no such element is found. |
| GetAsyncEnumerator | Returns an async enumerator that iterates through the set. |
| GetDefiningQuery | Returns the SQL query that is the source of data for the set. |
| GetEnumerator | Returns an enumerator that iterates through the set. |
| Include | Specifies the related objects to include in the query results. |
| IncludeMany | Specifies which collections to include in the query results. |
| LongCount() | Returns an Int64 that represents the total number of elements in the set. |
| LongCount(OperatorStringHandler) | Returns an Int64 that represents how many elements in the set satisfy a condition. |
| LongCount(String) | Returns an Int64 that represents how many elements in the set satisfy a condition. |
| LongCountAsync(CancellationToken) | Returns an Int64 that represents the total number of elements in the set. |
| LongCountAsync(OperatorStringHandler, CancellationToken) | Returns an Int64 that represents how many elements in the set satisfy a condition. |
| LongCountAsync(String, CancellationToken) | Returns an Int64 that represents how many elements in the set satisfy a condition. |
| OrderBy(OperatorStringHandler) | Sorts the elements of the set according to the columnList. |
| OrderBy(String) | Sorts the elements of the set according to the columnList. |
| Select(OperatorStringHandler) | Projects each element of the set into a new form. |
| Select(String) | Projects each element of the set into a new form. |
| Select(OperatorStringHandler, Type) | Projects each element of the set into a new form. |
| Select(String, Type) | Projects each element of the set into a new form. |
| Select<TResult>(OperatorStringHandler) | Projects each element of the set into a new form. |
| Select<TResult>(String) | Projects each element of the set into a new form. |
| Select<TResult>(OperatorStringHandler, Func<DbDataReader, TResult>) | Projects each element of the set into a new form. |
| Select<TResult>(String, Func<DbDataReader, TResult>) | Projects each element of the set into a new form. |
| Single() | The single element of the set. |
| Single(OperatorStringHandler) | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. |
| Single(String) | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. |
| SingleAsync(CancellationToken) | The single element of the set. |
| SingleAsync(OperatorStringHandler, CancellationToken) | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. |
| SingleAsync(String, CancellationToken) | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. |
| SingleOrDefault() | Returns the only element of the set, or a default value if the set is empty; this method throws an exception if there is more than one element in the set. |
| SingleOrDefault(OperatorStringHandler) | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |
| SingleOrDefault(String) | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |
| SingleOrDefaultAsync(CancellationToken) | Returns the only element of the set, or a default value if the set is empty; this method throws an exception if there is more than one element in the set. |
| SingleOrDefaultAsync(OperatorStringHandler, CancellationToken) | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |
| SingleOrDefaultAsync(String, CancellationToken) | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |
| Skip | Bypasses a specified number of elements in the set and then returns the remaining elements. |
| Take | Returns a specified number of contiguous elements from the start of the set. |
| ToArray | Creates an array from the set. |
| ToArrayAsync | Creates an array from the set. |
| ToList | Creates a List<T> from the set. |
| ToListAsync | Creates a List<T> from the set. |
| ToString | Returns the SQL query of the set. (Overrides Object.ToString()) |
| Where(OperatorStringHandler) | Filters the set based on a predicate. |
| Where(String) | Filters the set based on a predicate. |
Remarks
For information on how to use SqlSet see SqlSet Tutorial.