DataContext.GetTable Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
GetTable(Type) |
Returns a collection of objects of a particular type, where the type is defined by the |
GetTable<TEntity>() |
Returns a collection of objects of a particular type, where the type is defined by the |
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
.NET Framework 4.8.1 and other versions
Product | Versions |
---|---|
.NET Framework | 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
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
.NET Framework 4.8.1 and other versions
Product | Versions |
---|---|
.NET Framework | 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: