SqlSet<TResult> Class

Represents an immutable, connected SQL query that maps to TResult objects. This class cannot be instantiated, to get an instance use the From<TResult>(String) method.

Inheritance Hierarchy

System.Object
  DbExtensions.SqlSet
    DbExtensions.SqlSet<TResult>
      DbExtensions.SqlTable<TEntity>

Namespace:  DbExtensions
Assembly: DbExtensions.dll

Syntax

public class SqlSet<TResult> : SqlSet

Type Parameters

TResult

The type of objects to map the results to.

The SqlSet<TResult> type exposes the following members.

Properties

  Name Description
Public property ResultType The type of objects this set returns. This property can be null. (Inherited from SqlSet.)

Methods

  Name Description
Public method All Determines whether all elements of the set satisfy a condition. (Inherited from SqlSet.)
Public method Any() Determines whether the set contains any elements. (Inherited from SqlSet.)
Public method Any(String, Object[]) Determines whether any element of the set satisfies a condition. (Inherited from SqlSet.)
Public method AsEnumerable Gets all TResult objects in the set. The query is deferred-executed.
Public method Cast(Type) Casts the elements of the set to the specified type.
Public method Cast<T>() Casts the elements of the set to the specified type.
Public method Contains(Object) Checks the existance of the entity, using the primary key value.
Public method Contains(TResult) Checks the existance of the entity, using the primary key value.
Public method ContainsKey Checks the existance of an entity whose primary matches the id parameter. (Inherited from SqlSet.)
Public method Count() Returns the number of elements in the set. (Inherited from SqlSet.)
Public method Count(String, Object[]) Returns a number that represents how many elements in the set satisfy a condition. (Inherited from SqlSet.)
Public method Find Gets the entity whose primary key matches the id parameter.
Public method First() Returns the first element of the set.
Public method First(String, Object[]) Returns the first element in the set that satisfies a specified condition.
Public method FirstOrDefault() Returns the first element of the set, or a default value if the set contains no elements.
Public method FirstOrDefault(String, Object[]) Returns the first element of the set that satisfies a condition or a default value if no such element is found.
Public method GetDefiningQuery Returns the SQL query that is the source of data for the set. (Inherited from SqlSet.)
Public method GetEnumerator Returns an enumerator that iterates through the set.
Public method Include Specifies the related objects to include in the query results.
Public method LongCount() Returns an Int64 that represents the total number of elements in the set. (Inherited from SqlSet.)
Public method LongCount(String, Object[]) Returns an Int64 that represents how many elements in the set satisfy a condition. (Inherited from SqlSet.)
Public method OrderBy Sorts the elements of the set according to the columnList.
Public method Select(Type, String, Object[]) Projects each element of the set into a new form. (Inherited from SqlSet.)
Public method Select<TResult>(String, Object[]) Projects each element of the set into a new form. (Inherited from SqlSet.)
Public method Select<TResult>(Func<IDataRecord, TResult>, String, Object[]) Projects each element of the set into a new form. (Inherited from SqlSet.)
Public method Single() The single element of the set.
Public method Single(String, Object[]) Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists.
Public method 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.
Public method SingleOrDefault(String, Object[]) 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.
Public method Skip Bypasses a specified number of elements in the set and then returns the remaining elements.
Public method Take Returns a specified number of contiguous elements from the start of the set.
Public method ToArray Creates an array from the set.
Public method ToList Creates a List<TResult> from the set.
Public method ToString Returns the SQL query of the set. (Inherited from SqlSet.)
Public method Where Filters the set based on a predicate.

Remarks

For information on how to use SqlSet see SqlSet Tutorial.

See Also

Reference

DbExtensions Namespace

© Max Toro Q.