MetaModel.GetTable Method (String, Type)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Returns the metadata that describes the specified table.

Namespace:   System.Web.DynamicData
Assembly:  System.Web.DynamicData (in System.Web.DynamicData.dll)

public MetaTable GetTable(
	string tableName,
	Type contextType


Type: System.String

The name of the table.

Type: System.Type

The data context to search for the table.

Return Value

Type: System.Web.DynamicData.MetaTable

The metadata that describes the specified table.

Exception Condition

tablename or contextType is null.


The context is not registered or the table does not exist in the data context.

The following example shows how to use the GetTable(String, Type) method to obtain the metadata for the specified table. For a complete example, see GetTable.

// Get the metatable for the table with the 
// specified table name and the specified data
// context.
mTable = model.GetTable("CustomerAddresses", typeof(AdventureWorksLTDataContext));

.NET Framework
Available since 3.5
Return to top