DataContext.GetTable Method

Definition

Overloads

GetTable(Type)

Returns a collection of objects of a particular type, where the type is defined by the type parameter.

GetTable<TEntity>()

Returns a collection of objects of a particular type, where the type is defined by the TEntity parameter.

GetTable(Type)

Returns a collection of objects of a particular type, where the type is defined by the type parameter.

public:
 System::Data::Linq::ITable ^ GetTable(Type ^ type);
public System.Data.Linq.ITable GetTable (Type type);
member this.GetTable : Type -> System.Data.Linq.ITable
Public Function GetTable (type As Type) As ITable

Parameters

type
Type

The type of the objects to be returned.

Returns

A collection of objects defined by the type parameter.

Remarks

This is a weakly typed version of GetTable. It is important to have a weakly typed version because it is a relatively common practice to construct queries dynamically. It would be inconvenient to force the application to use reflection to call the correct generic method.

If there is no collection for a particular type, an exception is thrown.

Applies to

GetTable<TEntity>()

Returns a collection of objects of a particular type, where the type is defined by the TEntity parameter.

public:
generic <typename TEntity>
 where TEntity : class System::Data::Linq::Table<TEntity> ^ GetTable();
public System.Data.Linq.Table<TEntity> GetTable<TEntity> () where TEntity : class;
member this.GetTable : unit -> System.Data.Linq.Table<'Entity (requires 'Entity : null)> (requires 'Entity : null)
Public Function GetTable(Of TEntity As Class) () As Table(Of TEntity)

Type Parameters

TEntity

The type of the objects to be returned.

Returns

A collection of objects defined by the TEntity parameter.

Remarks

This method is the main entry point for querying. When a strongly typed DataContext is created, new generated properties encapsulate calls to this method. For example, a Customers property is generated that returns GetTable<Customer>.

If there is no collection for a particular type, an exception is thrown.

Applies to