Client Interfaces Guide > Connecting to TDV Server through ADO.NET > Sample Code for Testing of an ADO.NET Driver > Retrieving Metadata
 
Retrieving Metadata
The metadata capabilities in TDV ADO.NET Driver are exposed through a generic API using the CompositeConnection object. The CompositeConnection object's GetSchema method has overloads that allow you to pass the name of the schema information, called the metadata collection, that you are interested in. You can also pass filter information. The following table shows the GetSchema overloads.
Overload
Description
GetSchema()
Gets a DataTable with a row for each metadata collection that is available with this provider. This option is the same as calling GetSchema("MetaDataCollections").
GetSchema(string)
Passes a metadata collection name and gets a DataTable containing a row for each item found in that metadata collection in the database.
GetSchema(string, string array)
Passes a metadata collection name and an array of string values that specify how to filter the results, and gets a DataTable containing a row for each filtered item found in the metadata collection in the database.
You need an open connection to execute the GetSchema method. You can start by calling the GetSchema method with no parameters. It returns a list of the available metadata collections.
The following is a sample that retrieves the restrictions information for TABLES.
public void TestRestrictionInfo()
{
string space = " ";
CompositeConnection conn = GetConnection();
try
{
DataTable dt = conn.GetSchema("Restrictions");
foreach (DataRow myRow in dt.Rows)
{
if(myRow[0].ToString().ToUpper() == "TABLES")
{
Console.WriteLine(myRow[0] + space + myRow[1] + space + myRow[2]);
}
}
}
catch (Exception ex)
{
throw ex;
}
}
 
After you run the program, the following results appear. It shows that the metadata TABLES have four restrictions: catalog_name, schema_name, table_name, and table_type.