The C# Table<T> Class

Table<T> is the LINQ query root returned by Connection for a persistent class. It exposes the class extent as an IOrderedQueryable<T> and allows standard C# LINQ query syntax to be used on eXtremeDB objects.

For an overview see page C# Classes

Class Definition

    public class Table<T> : IOrderedQueryable<T> where T : class
    {
        public Table(Connection con);
        public Table(Connection con, Expression<Func<T, bool>> predicate);

        public IQueryable<T> Where(Expression<Func<T, bool>> predicate);
        public IEnumerable<T> Select(Expression<Func<T, bool>> predicate);

        public IEnumerator<T> GetEnumerator();
        IEnumerator IEnumerable.GetEnumerator();

        public Type ElementType { get; }
        public Expression Expression { get; }
        public IQueryProvider Provider { get; }
    }

Member Descriptions

Table<T> class
Represents the extent of a persistent class as a LINQ query source. Application code normally obtains a table through Connection.GetTable<T>() rather than constructing it directly.
Table(Connection con)
Creates a LINQ query root for class T on the specified connection.
Table(Connection con, Expression<Func<T, bool>> predicate)
Creates a LINQ query root with an initial predicate. This constructor is used by the connection-level Select<T>() helper and by the LINQ adapter itself.
Where(Expression<Func<T, bool>> predicate)
Associates a predicate with the table and returns the queryable root. In normal use this method is reached through C# LINQ query syntax or standard LINQ chaining.
Select(Expression<Func<T, bool>> predicate)
Returns an enumerable over objects of class T that satisfy the predicate. The adapter attempts to use suitable indexes when the predicate shape is recognized; otherwise it falls back to sequential filtering.
GetEnumerator()
Returns an enumerator over the current table query. Enumeration drives the underlying cursor or LINQ filtering logic.
ElementType
Returns the element type of the query, which is typeof(T).
Expression
Returns the LINQ expression representing the current query root.
Provider
Returns the LINQ query provider used by the managed adapter. This allows standard LINQ operators such as orderby and query comprehensions to be applied to the table.
Typical Usage
Use from obj in con.GetTable<T>() where ... select obj for query syntax, or con.Select<T>(predicate) for a short form when only filtering is needed.
Index Usage
The adapter tries to map recognized predicate shapes to cursor searches on available indexes. Supported cases include exact match, range comparisons, prefix searches, boolean tests, and some compound or multi-value predicates. If no suitable indexed plan is found, the adapter performs a sequential scan.
Sequential Search Accounting
Use Connection.NumberOfSequentialSearches to see how many times the LINQ adapter had to fall back to sequential evaluation for the current connection.
Extent Requirements
Enumeration requires the class to have an iterable extent. In practice this means an autoid index, a list index, or another suitable index that can be used to open a cursor. If no such index exists, evaluation throws ArgumentException.
Execution Model
Table<T> is not an SQL translation layer. It combines eXtremeDB cursor-based selection with the standard managed LINQ pipeline. Query operators beyond the adapter's index selection are applied by the LINQ layer over the enumerable produced by the adapter.
Threading
As with other connection-bound API objects, a table should be used only with the connection and thread that created it. Each thread should work through its own Connection.